1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Module not found: Error: Can't resolve '〇〇'

Posted at

エラー

ERROR in ./node_modules/@stomp/stompjs/lib/stomp-node.js
Module not found: Error: Can't resolve 'net' in '/Users/dragontaro/react/nem-wallet/node_modules/@stomp/stompjs/lib'
 @ ./node_modules/@stomp/stompjs/lib/stomp-node.js 26:13-27
 @ ./node_modules/@stomp/stompjs/index.js
 @ ./node_modules/nem-library/dist/src/infrastructure/Listener.js
 @ ./node_modules/nem-library/dist/src/infrastructure/BlockchainListener.js
 @ ./node_modules/nem-library/dist/src/infrastrcture.js
 @ ./node_modules/nem-library/dist/index.js
 @ ./src/components/Wallet.tsx
 @ ./src/containers/AppContainer.tsx
 @ ./src/index.tsx
 @ multi @babel/polyfill ./src/index.tsx

なんかこんなエラーがよくwebpackのときに出てよくわからないな〜って思ってたら、どうも魔法のコードでエラーがでなくなるみたい。

解決法

webpack.config.jsに

webpack.config.js
module.exports = {
  ...
  node: {
    fs: "empty",
    net: "empty",
    tls: "empty"
  }
};

こんな感じにエラーがでるやつを書いてやるとエラーは出なくなります。これが本当に解決できているのかは知らないですw

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?