reactjsnpmwebpack

using NPM to create React App: BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case


So for the past week or so I have been working on a project, a website for people who are fans of the band Gorillaz. I'm doing this project to fulfill the requirements of a Front End Engineering course that I am taking.

So Basically, so far the website is just very simple a couple of pages with React Routes leading to each one. I've got the routes working. Next, I made a page with API token data from ticketmaster.com that is going to show Tour dates for the band. That seems to just need a minor tweak, data.map is not a function etc etc. But however, the big problem that I am having relates to a NodeIRC based IRC chat room that I would like to implement for potential users to congregate to a chat room and discuss the music or whatever else etc. After I installed NodeIRC and tried to link it on the page, I was getting a complaint from my error log that said that I would need webpack to do what I'm trying to do, basically. Anyway, After I installed webpack, this is the error log that I get (I will also include my main App.js file, keep in mind it's a React based App).

ERROR in ./node_modules/chrome-trace-event/dist/trace-event.js 13:17-34
Module not found: Error: Can't resolve 'stream' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/chrome-trace-event/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
ERROR in ./node_modules/enhanced-resolve/lib/MainFieldPlugin.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/enhanced-resolve/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/enhanced-resolve/lib/util/path.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/enhanced-resolve/lib/util'
Did you mean './path'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /home/eliast/Documents/final reactapp project/gorillazfansite/node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/graceful-fs/graceful-fs.js 1:9-22
Module not found: Error: Can't resolve 'fs' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/graceful-fs'
ERROR in ./node_modules/graceful-fs/legacy-streams.js 1:13-37
Module not found: Error: Can't resolve 'stream' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
ERROR in ./node_modules/graceful-fs/polyfills.js 1:16-36
Module not found: Error: Can't resolve 'constants' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/graceful-fs'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "constants": require.resolve("constants-browserify") }'
    - install 'constants-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "constants": false }
ERROR in ./node_modules/jest-worker/build/base/BaseWorkerPool.js 8:39-54
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/base'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/jest-worker/build/index.js 26:15-28
Module not found: Error: Can't resolve 'os' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }
ERROR in ./node_modules/jest-worker/build/workers/ChildProcessWorker.js 8:15-39
Module not found: Error: Can't resolve 'child_process' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/jest-worker/build/workers/ChildProcessWorker.js 15:15-32
Module not found: Error: Can't resolve 'stream' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
ERROR in ./node_modules/jest-worker/build/workers/NodeThreadsWorker.js 8:39-54
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/jest-worker/build/workers/NodeThreadsWorker.js 15:15-32
Module not found: Error: Can't resolve 'stream' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
ERROR in ./node_modules/jest-worker/build/workers/NodeThreadsWorker.js 22:15-40
Module not found: Error: Can't resolve 'worker_threads' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/jest-worker/build/workers/messageParent.js 21:8-33
Module not found: Error: Can't resolve 'worker_threads' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/jest-worker/build/workers'
ERROR in ./node_modules/loader-runner/lib/LoaderRunner.js 5:9-22
Module not found: Error: Can't resolve 'fs' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/loader-runner/lib'
ERROR in ./node_modules/merge-stream/index.js 5:4-21
Module not found: Error: Can't resolve 'stream' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/merge-stream'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
    - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "stream": false }
ERROR in ./node_modules/mime-types/index.js 15:14-37
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/mime-types'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/node-irc/lib/client.js 29:16-30
Module not found: Error: Can't resolve 'net' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/node-irc/lib'
ERROR in ./node_modules/terser-webpack-plugin/dist/index.js 3:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/terser-webpack-plugin/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/terser-webpack-plugin/dist/index.js 4:11-24
Module not found: Error: Can't resolve 'os' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/terser-webpack-plugin/dist'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 406:6-26
Module not found: Error: Can't resolve 'uglify-js' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 484:14-34
Module not found: Error: Can't resolve '@swc/core' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 567:18-36
Module not found: Error: Can't resolve 'esbuild' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/terser-webpack-plugin/dist'
ERROR in ./node_modules/watchpack/lib/DirectoryWatcher.js 9:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/watchpack/lib/DirectoryWatcher.js 13:15-37
Module not found: Error: Can't resolve 'os' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }
ERROR in ./node_modules/watchpack/lib/LinkResolver.js 7:11-24
Module not found: Error: Can't resolve 'fs' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'
ERROR in ./node_modules/watchpack/lib/LinkResolver.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/watchpack/lib/getWatcherManager.js 7:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/watchpack/lib/reducePlan.js 7:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/watchpack/lib/watchEventSource.js 7:11-24
Module not found: Error: Can't resolve 'fs' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'
ERROR in ./node_modules/watchpack/lib/watchEventSource.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/watchpack/lib/watchEventSource.js 13:15-37
Module not found: Error: Can't resolve 'os' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/watchpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }
ERROR in ./node_modules/webpack/hot/lazy-compilation-node.js 18:47-63
Module not found: Error: Can't resolve 'https' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/hot'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
    - install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "https": false }
ERROR in ./node_modules/webpack/hot/lazy-compilation-node.js 18:66-81
Module not found: Error: Can't resolve 'http' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/hot'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
    - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "http": false }
ERROR in ./node_modules/webpack/lib/FileSystemInfo.js 11:19-36
Module not found: Error: Can't resolve 'module' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib'
ERROR in ./node_modules/webpack/lib/FileSystemInfo.js 15:4-19
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/NormalModule.js 13:20-42
Module not found: Error: Can't resolve 'querystring' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "querystring": require.resolve("querystring-es3") }'
    - install 'querystring-es3'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "querystring": false }
ERROR in ./node_modules/webpack/lib/TemplatedPathPlugin.js 12:4-19
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/asset/AssetGenerator.js 9:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/asset'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/cli.js 8:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/config/browserslistTargetHandler.js 9:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/config'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/config/defaults.js 8:11-24
Module not found: Error: Can't resolve 'fs' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/config'
ERROR in ./node_modules/webpack/lib/config/defaults.js 9:13-28
Module not found: Error: Can't resolve 'path' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/config'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }
ERROR in ./node_modules/webpack/lib/hmr/lazyCompilationBackend.js 30:27-43
Module not found: Error: Can't resolve 'https' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/hmr'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "https": require.resolve("https-browserify") }'
    - install 'https-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "https": false }
ERROR in ./node_modules/webpack/lib/hmr/lazyCompilationBackend.js 30:46-61
Module not found: Error: Can't resolve 'http' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/hmr'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
    - install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "http": false }
ERROR in ./node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js 14:11-24
Module not found: Error: Can't resolve 'vm' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/javascript'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "vm": require.resolve("vm-browserify") }'
    - install 'vm-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "vm": false }
ERROR in ./node_modules/webpack/lib/javascript/JavascriptParser.js 18:11-24
Module not found: Error: Can't resolve 'vm' in '/home/eliast/Documents/final reactapp project/gorillazfansite/node_modules/webpack/lib/javascript'

And it just goes on and on like that

I will show the App.js file on my second post (the NodeIRC room is being implemented on another file, ForumsandIRC.js, which I can provide upon request):

  1. I added NodeIRC package to my npm createreactapp build
  2. Saw error related to the need to install webpack, so did so and imported webpack to my App.js and the other js page that is using the NodeIRC module. Added rudimentary setup code to the secondary file with the NodeIRC module.
  3. See this long page of errors whenever I reach the 'homepage' of the app now.
  4. Tried some solutions from another similar thread How to Polyfill node core modules in webpack 5 -- to no avail. 56 errors still present, all related to webpack

Solution

  • The error you get means that you try to compile Node.js code with webpack and that it is not configured for it. For a React app created with CRA, the Webpack target is set to the default value browserlist, as you can see on react-scripts config here. This target does not support Node.js core modules, as the error explains.

    The library you want to use, node-irc, is a Node.js library, and you can't use Node.js on the browser side like React. If you want to use this library you need a Node.js backend. This is also explained on this issue by another user.