Использование NPM для создания приложения React: СЕРЬЕЗНОЕ ИЗМЕНЕНИЕ: webpack <5 используется для включения полифилов для основных модулей node.js по умолчанию. Это уже не так

Итак, последнюю неделю или около того я работал над проектом — веб-сайтом для поклонников группы Gorillaz. Я делаю этот проект, чтобы выполнить требования курса Front End Engineering, который я прохожу.

В общем, пока веб-сайт представляет собой всего лишь пару страниц с React Routes, ведущими к каждой из них. У меня маршруты работают. Затем я создал страницу с данными токенов API с сайта Ticketmaster.com, на которой будут показаны даты тура группы. Кажется, это просто требует небольшой настройки, data.map is not a function и т. д. и т. п. Но, тем не менее, большая проблема, с которой я столкнулся, связана с чатом IRC на базе NodeIRC, который я хотел бы реализовать, чтобы потенциальные пользователи могли собираться в чате и обсуждать музыку. или что-то еще и т. д. После того, как я установил NodeIRC и попытался связать его на странице, я получил жалобу из журнала ошибок, в которой говорилось, что мне понадобится веб-пакет, чтобы делать то, что я пытаюсь сделать. В любом случае, после установки веб-пакета я получаю вот такой журнал ошибок (я также включу свой основной файл App.js, имейте в виду, что это приложение на основе React).

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'

И это продолжается и продолжается вот так

Файл App.js я покажу во втором посте (комната NodeIRC реализуется в другом файле ForumsandIRC.js, который я могу предоставить по запросу):

  1. Я добавил пакет NodeIRC в свою сборку npm createreactapp.
  2. Увидел ошибку, связанную с необходимостью установки веб-пакета, поэтому сделал это и импортировал веб-пакет в свой App.js и на другую страницу js, использующую модуль NodeIRC. Добавлен элементарный код установки во вторичный файл с модулем NodeIRC.
  3. Просматривайте эту длинную страницу ошибок всякий раз, когда я сейчас попадаю на «домашнюю страницу» приложения.
  4. Пробовал некоторые решения из другой похожей темы Как заполнять модули ядра узла Polyfill в веб-пакете 5 — безрезультатно. По-прежнему присутствует 56 ошибок, все они связаны с веб-пакетом.

Если вам нужно просмотреть содержимое App.js или ForumsandIRC.js, пожалуйста, напишите мне в личку.

Emandudeguy 21.06.2024 05:45

Отвечает ли это на ваш вопрос? Как заполнять модули ядра узла Polyfill в Webpack 5

Ken Y-N 21.06.2024 08:19

Я попробовал несколько решений в этой теме и все равно получаю 56 ошибок, в основном все из которых связаны с проблемой полифилов Webpack 5.

Emandudeguy 21.06.2024 09:29

для справки: я программирую всего около 6 месяцев. Возможно, я неправильно реализовал веб-пакет. Я не уверен на 100%.

Emandudeguy 21.06.2024 10:39

Я не могу отметить дубликат, но это та же проблема, что и эта -> stackoverflow.com/a/78161983/9718056

Arkellys 22.06.2024 07:38

@Arkellys Я посмотрю эту тему на выходных. Большое спасибо. Как я уже сказал, я новичок, поэтому иногда мне кажется, что я знаю, что делаю, но это не так.

Emandudeguy 22.06.2024 07:42

Все нормально. Если это решит вашу проблему, я был бы рад получить ответ за ответ, чтобы я мог использовать его для дубликатов в будущем. На самом деле это очень распространенная проблема.

Arkellys 22.06.2024 07:43

Эй, согласно этому ответу, проблема в файле webpack.config.js? Если да, то как мне исправить проблемы с файлом конфигурации? Я не чувствую себя ближе к пониманию этого, извини.

Emandudeguy 23.06.2024 05:03

Хорошо, вот в чем дело. Я оставил файл webpack.config.js в покое и решил поставить npm i *package name* -S для всех пакетов, для которых я получал коды ошибок. Теперь я получаю только 20 ошибок, что не так уж плохо, но я все еще не могу устранить остальные, все еще в основном связанные с кодом ошибки веб-пакета.

Emandudeguy 23.06.2024 05:26

@Emandudeguy В ответе объясняется, в чем проблема и как ее решить. Вам не нужно устанавливать новые пакеты или редактировать конфигурацию веб-пакета. Что ты не понимаешь? Я могу отредактировать, чтобы добавить больше деталей.

Arkellys 23.06.2024 08:21

Я не уверен, как реализовать ваше решение, потому что я не использую ни один из модулей, которые вы упомянули в своем ответе. Не использую Electron или Node.js. Я сузил список до 20 ошибок из 56, мне все равно нужно найти недостающее звено, потому что я чего-то не понимаю. Я не знаю, как выполнить предварительную загрузку, потому что никогда этого не делал и не уверен, что это то, что мне нужно в моей конкретной ситуации.

Emandudeguy 24.06.2024 09:43

@Emandudeguy Я чувствую себя глупо, я был уверен, что ты использовал Electron! Я перепутал теги просмотра. Так что нет, никакой предварительной нагрузки или чего-то подобного. Однако причина ошибки все еще актуальна. Напишу ответ по вашему случаю.

Arkellys 25.06.2024 06:53
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
В JavaScript одним из самых запутанных понятий является поведение ключевого слова "this" в стрелочной и обычной функциях.
Концепция локализации и ее применение в приложениях React ⚡️
Концепция локализации и ее применение в приложениях React ⚡️
Локализация - это процесс адаптации приложения к различным языкам и культурным требованиям. Это позволяет пользователям получить опыт, соответствующий...
Навигация по приложениям React: Исчерпывающее руководство по React Router
Навигация по приложениям React: Исчерпывающее руководство по React Router
React Router стала незаменимой библиотекой для создания одностраничных приложений с навигацией в React. В этой статье блога мы подробно рассмотрим...
Массив зависимостей в React
Массив зависимостей в React
Все о массиве Dependency и его связи с useEffect.
0
12
232
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Полученная ошибка означает, что вы пытаетесь скомпилировать код Node.js с помощью веб-пакета, но он для этого не настроен. Если приложение React создано с помощью CRA , для цели Webpack установлено значение по умолчанию browserlist, как вы можете видеть в конфигурации React-скриптов здесь. Эта цель не поддерживает основные модули Node.js, как поясняет ошибка.

Библиотека, которую вы хотите использовать, node-irc , представляет собой библиотеку Node.js, и вы не можете использовать Node.js на стороне браузера, как React. Если вы хотите использовать эту библиотеку, вам понадобится серверная часть Node.js. Это также объяснено в этом выпуске другим пользователем.

Спасибо. Мне нужно многому научиться. Я рассмотрю документацию node-irc и node.js, чтобы понять, как я это реализую.

Emandudeguy 27.06.2024 01:44

Другие вопросы по теме