Open damozhang opened 2 years ago
I have the same issue as well
me too
Webpack 5 no longer shims node builtin packages. Its a breaking change.
I try to upgrade from v4.0.3 to 5.0.0 and It raise up the same error
Compiled with problems:
ERROR in ./src/App.js 1:40-111
Module not found: Error: You attempted to import /home/xxx/web/node_modules/react-refresh/runtime.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.
Webpack 5 no longer shims node builtin packages. Its a breaking change.
Are we meant to eject for every app that relies on node builtin packages? Won't that be most production apps, since you will invariably import a node module that relies on this functionality
My personal view: I personally consider it bad practice to include code in the front-end that was ment for back-end usage. From my experience: I've seen developers of any experienced try adding back-end npm packages on the front-end.
In Npm there is no clear difference to help out developers, it's "Node Packages" not "Browser Packages"
Package maintainers should ideally build node or browser specific bundles.
Again this is my personal view I support the move in Webpack, I'll of course bring it up in the maintainer group.
(Also see the release notes regarding webpack 5 - there's a note regarding this breaking change for further details)
For now it would be helpful to collect examples of front-end packages suffering from this issue. (The examples would help us reevaluate the decision)
Our two main usages are:
Our back-end compresses some of its data to optimize storage as well as network transfer. Our UI then uses zlib to uncompress it. Our UI can also login using OAuth and it uses the crypto randomBytes and createHash methods to generate data for that authorization
Webpack has some output about providing a fallback resolution, what's the correct way to supply that since we don't have access to the actual webpack config?
To toss in another example, the v5 upgrade showed me that the libraries for AWS Cognito use url:
> yarn build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve 'url' in '/path/to/app/.yarn/cache/@aws-amplify-core-npm-4.3.10-e9277c22ab-77b7fe62d8.zip/node_modules/@aws-amplify/core/lib-esm'
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: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
>
If you were a direct user of webpack v4, upgrading to v5, you have a few options: 1) stay on v4 2) remove usage of polyfilled modules 3) add polyfills
If I were in this situation, I'd be taking option 3. But as I understand it, that's not available today with non-ejected CRA.
It'd be nice if Webpack 5 had a single switch to flip, to restore v4's polyfill behavior. Then CRA could expose just that one switch. But there isn't: Webpack's migration guidance is to manually add polyfills to your webpack config.
https://webpack.js.org/blog/2020-10-10-webpack-5-release/#automatic-nodejs-polyfills-removed
Here are the polyfills that were formerly provided by webpack (note that the project is deprecated): https://github.com/webpack/node-libs-browser
..so what should CRA do?
I've added a pr to gather feedback #11764
Same issue here. is there some documentation that we can follow for doing this migration?
I'm not sure it's entirely a polyfill issue. I'm getting the Can't resolve 'fs'
due to Handlebars, which (IIRC) should have been prevented by its browser
setting in package.json.
@LukeNotable thanks, interesting finding - I'll convert #11764 to a draft for now - would be great if it's an issue in the webpack config not resolving main fields correctly ref config: https://webpack.js.org/configuration/resolve/#resolvemainfields - will try to replicate
@zfarhad I had the same issue. Found out it was because I had Storybook as a dependency and it was using Webpack 4. Upgrading Storybook to use their new alpha version that supports Webpack 5 fixed me. So I would say, make sure none of your dependencies are using a conflicting version of webpack.
@LukeNotable when importing 'handlebars/runtime' webpack seem to resolve correctly but if importing 'handlebars' it resolves to 'lib/index.js'
''' "browser": { ".": "./dist/cjs/handlebars.js", "./runtime": "./dist/cjs/handlebars.runtime.js" }, ''' I'll take a second look tomorrow, could be a config issue in CRA
ERROR in Plugin "react" was conflicted between "package.json » eslint-config-react-app. Estoy teniedo este error y no encuentro como solucionarlo..
Fwiw, seeing this for a package trying to use assert and stream-browserify.
Webpack 5 and CRA v5 don't add fallbacks for nodejs modules any more, it's a breaking change - dotenv should not be added in the browser code related issues closed in dotenv repo
Migration steps from v4 to v5:
A: Go to the Npm or Github readme for the package you are trying to use and see if the package is meant to run in the browser
B: Search in the package Github issues for "browser" and include closed issues, please. Example for DotEnv repo
C: If the package should support the browser - then open an issue here in the CRA repo and we'll look into it - here to help!
An example: @LukeNotable raised an issue - we've confirmed that as an issue, debugged and opened an issue in the Webpack repository.
Please note a very important detail regarding the handlebars
package:
import "handlebars/runtime"
resolves in the browser codeimport "handlebars"
resolves NodeJS version... Adding fallbacks for nodejs builtins would hide this issueWe have opened an issue in Webpack https://github.com/webpack/webpack/issues/15007
Sorry for the breaking change, but we are trying to keep you safe - we are considering better error message / documentation etc.
Kind regards Morten
Uh my guess is that this means a lot people can not upgrade to v5 for a long time. In example our own deps report 50 errors cause nodes assert ist used in various deps.
"Then remove the package and find an alternative package better suited" is a great strategy when you have an unlimited budget, but in many cases these packages work just fine in the browser with a polyfill, and sometimes packages in the JS ecosystem go unmaintained and there aren't any good alternatives. If Webpack 5 has an option to include the polyfills, but CRA does not, are we just expected to immediately eject upon upgrading to edit the webpack config, or just stay on CRA 4?
We need to make sure that we are fixing the root cause and not the symptom - like with the handlebars
example above e.g. There might be an issue in Webpack https://github.com/webpack/webpack/issues/15007 - let's evaluate if that fixes most of the errors.
To repeat https://github.com/facebook/create-react-app/issues/11756#issuecomment-994982058 we a considering adding an escape hatch and document why not to use it #11764
Again - if you are using packages not meant for the browser - and the maintainers of those packages keep closing issues for browser support and state that the package is not meant for the browser, then it's likely a good idea to find another package that supports the browser.
For more details on what nodejs builtin modules are see the nodejs api docs
same issue here with web3 js :/
I've added a pull-request with a suggestion for an "escape hatch" - still waiting for the webpack team to confirm/deny the handlebars issue - let me know what you think https://github.com/facebook/create-react-app/pull/11764
Same issue here with PixiJS v4
npx create-react-app myApp cd myApp npm install web3 open App.js and add line import Web3 from 'web3' and you get errors related to the missing polyfills. Any suggestion on a workaround?
I'm having similar issue earlier with CRA & web3. I fixed it by changing react-scripts
from 5.0.0
to version 4.0.3
Same issue here with ethers js.
Module not found: Error: Can't resolve 'fs' in "node-env/file/path" Module not found: Error: Can't resolve 'path' in "node-env/file/path" Module not found: Error: Can't resolve 'os' in "node-env/file/path
Forced to use old version of react scripts, which in turn forces me to use an old version of tailwind :(
@kayrules 's solution works fine. the web3 package is currently unusable without downgrading react-scripts
I temporarily dealt with this by adding aliases to my dependencies. How bad is this solution?
Example:
"buffer": "^6.0.3",
"crypto": "npm:crypto-browserify",
"stream": "npm:stream-browserify",
I solved this issue by adding the fallback to my webpack.config.js file;
module.exports = {
resolve: {
fallback: {
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
stream: require.resolve('stream-browserify'),
},
},
};
using;
"dependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.2",
"web3": "^1.6.1"
},
but also need but got compilation errors on the build process:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
this was resolved by adding to my .env file;
GENERATE_SOURCEMAP=false
hope this helps.
I solved this by modifying my webpack config. However I didn't need to eject my app as I'd already been using react-app-rewired to inject additional config - worth having a look for anyone needing to edit webpack config and not wanting to eject.
This was the config setting:
config.resolve.fallback = { fs: false, path: false }
You can create this in the src folder and react should pick it up. [image: Screenshot 2021-12-21 at 17.55.15.png]
the .env file is in the root.
On Tue, 21 Dec 2021 at 17:38, Ankit Kumar @.***> wrote:
I solved this issue by adding the fallback to my webpack.config.js file;
module.exports = { resolve: { fallback: { assert: require.resolve('assert'), crypto: require.resolve('crypto-browserify'), http: require.resolve('stream-http'), https: require.resolve('https-browserify'), os: require.resolve('os-browserify/browser'), stream: require.resolve('stream-browserify'), }, }, };
using;
"dependencies": { @./jest-dom": "^5.16.1", @./react": "^12.1.2", @.***/user-event": "^13.5.0", "react": "^17.0.2", "react-dom": "^17.0.2", "react-scripts": "5.0.0", "web-vitals": "^2.1.2", "web3": "^1.6.1" },
but also need but got compilation errors on the build process:
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
this was resolved by adding to my .env file;
GENERATE_SOURCEMAP=false
hope this helps.
How do you access webpack.config.js file where is the location
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-998970294, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCFPX5GJWJEQWFG4TA3USC3RDANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
-- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
`Compiled with problems:
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in 'C:\Blockchain\lottery-React\node_modules\cipher-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:
ERROR in ./node_modules/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\eth-lib\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:
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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:
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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:
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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:
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\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:
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\node_modules\eth-lib\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:
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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:
ERROR in ./node_modules/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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:
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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:
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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:
ERROR in ./node_modules/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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:
ERROR
src\App.js Line 4:1: Import in body of module; reorder to top import/first
Search for the keywords to learn more about each error.
`
This is my error how do i solve ???
`Compiled with problems:
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in 'C:\Blockchain\lottery-React\node_modules\cipher-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: { "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/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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
src\App.js Line 4:1: Import in body of module; reorder to top import/first
Search for the keywords to learn more about each error.
`
This is my error how do i solve ???
Try the suggested fix first....
I have tried by creating a webpack.config.js file in src folder as u suggested. But nothing works. I am trying this from 4 days . Ur help is much appreciated.
On Tue, Dec 21, 2021, 23:57 steveilyo @.***> wrote:
`Compiled with problems:
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in 'C:\Blockchain\lottery-React\node_modules\cipher-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: { "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/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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
src\App.js Line 4:1: Import in body of module; reorder to top import/first
Search for the keywords to learn more about each error.
`
This is my error how do i solve ???
Try the suggested fix first....
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-999000685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3DMOEBDWHXWI6OSYVFGELUSDBKBANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
It sounds like it’s not picking up the config.
On 21 Dec 2021, at 18:30, Ankit Kumar @.***> wrote:
I have tried by creating a webpack.config.js file in src folder as u suggested. But nothing works. I am trying this from 4 days . Ur help is much appreciated.
On Tue, Dec 21, 2021, 23:57 steveilyo @.***> wrote:
`Compiled with problems:
ERROR in ./node_modules/cipher-base/index.js 3:16-43
Module not found: Error: Can't resolve 'stream' in 'C:\Blockchain\lottery-React\node_modules\cipher-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: { "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/eth-lib/lib/bytes.js 9:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/account.js 71:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/address.js 14:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/ethereumjs-util/dist.browser/object.js 46:31-48
Module not found: Error: Can't resolve 'assert' in 'C:\Blockchain\lottery-React\node_modules\ethereumjs-util\dist.browser'
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: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false }
ERROR in ./node_modules/web3-eth-accounts/lib/index.js 31:74-91
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-eth-accounts/node_modules/eth-lib/lib/bytes.js 7:193-227
Module not found: Error: Can't resolve 'crypto' in 'C:\Blockchain\lottery-React\node_modules\web3-eth-accounts\node_modules\eth-lib\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: { "crypto": require.resolve("crypto-browserify") }' - install 'crypto-browserify' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "crypto": false }
ERROR in ./node_modules/web3-providers-http/lib/index.js 30:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/web3-providers-http/lib/index.js 32:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\web3-providers-http\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: { "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/xhr2-cookies/dist/xml-http-request.js 37:11-26
Module not found: Error: Can't resolve 'http' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 39:12-28
Module not found: Error: Can't resolve 'https' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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: { "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/xhr2-cookies/dist/xml-http-request.js 41:9-22
Module not found: Error: Can't resolve 'os' in 'C:\Blockchain\lottery-React\node_modules\xhr2-cookies\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
src\App.js Line 4:1: Import in body of module; reorder to top import/first
Search for the keywords to learn more about each error.
`
This is my error how do i solve ???
Try the suggested fix first....
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-999000685, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN3DMOEBDWHXWI6OSYVFGELUSDBKBANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.
@ankitaryan404 perhaps try this solution, as this one also worked for me:
I solved this by modifying my webpack config. However I didn't need to eject my app as I'd already been using react-app-rewired to inject additional config - worth having a look for anyone needing to edit webpack config and not wanting to eject. This was the config setting:
config.resolve.fallback = { fs: false, path: false }
Please note that you need to install and configure react-app-rewired npm package.
My config-overrides.js file looks like this:
module.exports = function override(config, env) {
config.resolve = {
...config.resolve,
fallback: {
vm: require.resolve('vm-browserify')
}
}
return config
}
My broken dependency was vm-browserify, so I had to also install package for it. But for other polyfills it probably should work by following the same pattern.
…
maybe yeah same with me the webpack.config.js is on root how it's can't be picked
…
maybe yeah same with me the webpack.config.js is on root how it's can't be picked
i have tried both the way , but doesn't work. Can Anyone plz see the pic and give the solution. If I am doing anything wrong , then guide me . This would be appreciated
Looks like you are on windows, I'm on OSX so a bit different.
If you want to find webpack files and configurations go to your package.json file and look for scripts
[image: img]
You will find that scripts object is using a library react-scripts
This react-scripts/scripts and react-scripts/config folder should contain all the webpack configurations.
On Wed, 22 Dec 2021 at 10:50, Ankit Kumar @.***> wrote:
…
maybe yeah same with me the webpack.config.js is on root how it's can't be picked
[image: WhatsApp Image 2021-12-22 at 16 14 37] https://user-images.githubusercontent.com/58078776/147080655-97434a9b-632c-467f-9e58-07d336de38c2.jpeg [image: WhatsApp Image 2021-12-22 at 16 16 14] https://user-images.githubusercontent.com/58078776/147080918-e0680ed5-ab6b-4c3a-b00a-249f29e5e987.jpeg [image: WhatsApp Image 2021-12-22 at 16 17 06] https://user-images.githubusercontent.com/58078776/147080938-4aeb1d29-f0cd-4a05-8b55-b723c8584f19.jpeg
i have tried both the way , but doesn't work. Can Anyone plz see the pic and give the solution. If I am doing anything wrong , then guide me . This would be appreciated
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-999476911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCD3HI75VMPN2YW4OGDUSGUOHANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
-- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
Arrhhh taking a second look I have my webpack in the src folder.
On Wed, 22 Dec 2021 at 10:50, Ankit Kumar @.***> wrote:
…
maybe yeah same with me the webpack.config.js is on root how it's can't be picked
[image: WhatsApp Image 2021-12-22 at 16 14 37] https://user-images.githubusercontent.com/58078776/147080655-97434a9b-632c-467f-9e58-07d336de38c2.jpeg [image: WhatsApp Image 2021-12-22 at 16 16 14] https://user-images.githubusercontent.com/58078776/147080918-e0680ed5-ab6b-4c3a-b00a-249f29e5e987.jpeg [image: WhatsApp Image 2021-12-22 at 16 17 06] https://user-images.githubusercontent.com/58078776/147080938-4aeb1d29-f0cd-4a05-8b55-b723c8584f19.jpeg
i have tried both the way , but doesn't work. Can Anyone plz see the pic and give the solution. If I am doing anything wrong , then guide me . This would be appreciated
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-999476911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCD3HI75VMPN2YW4OGDUSGUOHANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
-- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
Arrhhh taking a second look I have my webpack in the src folder. … On Wed, 22 Dec 2021 at 10:50, Ankit Kumar @.> wrote: … maybe yeah same with me the webpack.config.js is on root how it's can't be picked [image: WhatsApp Image 2021-12-22 at 16 14 37] https://user-images.githubusercontent.com/58078776/147080655-97434a9b-632c-467f-9e58-07d336de38c2.jpeg [image: WhatsApp Image 2021-12-22 at 16 16 14] https://user-images.githubusercontent.com/58078776/147080918-e0680ed5-ab6b-4c3a-b00a-249f29e5e987.jpeg [image: WhatsApp Image 2021-12-22 at 16 17 06] https://user-images.githubusercontent.com/58078776/147080938-4aeb1d29-f0cd-4a05-8b55-b723c8584f19.jpeg i have tried both the way , but doesn't work. Can Anyone plz see the pic and give the solution. If I am doing anything wrong , then guide me . This would be appreciated — Reply to this email directly, view it on GitHub <#11756 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCD3HI75VMPN2YW4OGDUSGUOHANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.> -- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
As you have seen in my pic I have tried both way But none of them had worked out
Try here: lottery-react/node_modules/react-scripts/config/webpack.config.js
or use react app rewired;
A great tutorial by Egghead.io using react-app-rewired here https://egghead.io/lessons/react-customize-create-react-app-cra-without-ejecting-using-react-app-rewired
On Wed, 22 Dec 2021 at 11:13, Ankit Kumar @.***> wrote:
Arrhhh taking a second look I have my webpack in the src folder. … <#m8959180397848714403> On Wed, 22 Dec 2021 at 10:50, Ankit Kumar @.> wrote: … maybe yeah same with me the webpack.config.js is on root how it's can't be picked [image: WhatsApp Image 2021-12-22 at 16 14 37] https://user-images.githubusercontent.com/58078776/147080655-97434a9b-632c-467f-9e58-07d336de38c2.jpeg https://user-images.githubusercontent.com/58078776/147080655-97434a9b-632c-467f-9e58-07d336de38c2.jpeg [image: WhatsApp Image 2021-12-22 at 16 16 14] https://user-images.githubusercontent.com/58078776/147080918-e0680ed5-ab6b-4c3a-b00a-249f29e5e987.jpeg https://user-images.githubusercontent.com/58078776/147080918-e0680ed5-ab6b-4c3a-b00a-249f29e5e987.jpeg [image: WhatsApp Image 2021-12-22 at 16 17 06] https://user-images.githubusercontent.com/58078776/147080938-4aeb1d29-f0cd-4a05-8b55-b723c8584f19.jpeg https://user-images.githubusercontent.com/58078776/147080938-4aeb1d29-f0cd-4a05-8b55-b723c8584f19.jpeg i have tried both the way , but doesn't work. Can Anyone plz see the pic and give the solution. If I am doing anything wrong , then guide me . This would be appreciated — Reply to this email directly, view it on GitHub <#11756 (comment) https://github.com/facebook/create-react-app/issues/11756#issuecomment-999476911>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCD3HI75VMPN2YW4OGDUSGUOHANCNFSM5KCLFL7Q https://github.com/notifications/unsubscribe-auth/AORFPCD3HI75VMPN2YW4OGDUSGUOHANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you commented.Message ID: @.> -- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
As you have seen in my pic I have tried both way But none of them had worked out
— Reply to this email directly, view it on GitHub https://github.com/facebook/create-react-app/issues/11756#issuecomment-999492107, or unsubscribe https://github.com/notifications/unsubscribe-auth/AORFPCEEDHYKW7UHXDY74GDUSGXGJANCNFSM5KCLFL7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you commented.Message ID: @.***>
-- Many Thanks Steve Winnington tel: 07810 026118 ln: steve-winnington https://www.linkedin.com/in/steve-winnington-305a0914
Thanks @raix for going above & beyond looking into the handlebars issue!
For me, it was the only hiccup in an otherwise smooth upgrade to CRA 5, and the workaround is straightforward.
Same problem with rsocket-core
package. It uses Buffer
for encode/decode messages.
ERROR in ./node_modules/rsocket-core/build/LiteBuffer.js 8:37-54
Module not found: Error: Can't resolve 'buffer' in '/Users/development/projects/falcon/backoffice/node_modules/rsocket-core/build'
@steveilyo react-app-rewired helps in some case ,i resolve errors but now my view page not render XD After reviewing my app i found when i cathc error,somehow react-redux don't like my destructive import in actions-creators from reducer,i brought out constants in other folder and exported them from file,now it works.
I somehow fixed it too using react-app-rewired
Make sure you install this package and create new file config-overrides.js
in your root directory
/* config-overrides.js */
const webpack = require('webpack');
module.exports = function override(config, env) {
//do stuff with the webpack config...
config.resolve.fallback = {
url: require.resolve('url'),
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
};
config.plugins.push(
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
);
return config;
}
Now edit your package.json
for making react-app-rewired
to work.
//package.json
...
"dependencies": {
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"assert": "^2.0.0",
"buffer": "^6.0.3",
"crypto": "npm:crypto-browserify",
"crypto-browserify": "^3.12.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"react": "^17.0.2",
"react-app-rewired": "^2.1.9",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"rewire": "^6.0.0",
"stream": "npm:stream-browserify",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.0",
"web-vitals": "^2.1.2",
"web3": "^1.6.1"
},
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-app-rewired eject"
},
Hope this helps.
Thanks.
I was also having trouble with the same error when using .env
(it was fine in past versions), but I removed the following code and it worked. (Sorry if this has nothing to do with the discussion!)
import dotenv from 'dotenv';
dotenv.config();
Hi Guys i'm using latest version
React => v17 React scripts=> v5 webpack => v5
To Fix The Problem
`
"stream-http": "^3.2.0",//stream-http
`
Create config-coverrides.js in Root dir like this 👇
const webpack = require('webpack');
module.exports = function override(config, env) {
config.resolve.fallback = {
url: require.resolve('url'),
fs: require.resolve('fs'),
assert: require.resolve('assert'),
crypto: require.resolve('crypto-browserify'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify/browser'),
buffer: require.resolve('buffer'),
stream: require.resolve('stream-browserify'),
};
config.plugins.push(
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
);
return config;
}
I.e 👇
Hope this Help
Describe the bug
Compiled with problems
Did you try recovering your dependencies?
Which terms did you search for in User Guide?
react-scripts 5 webpack Module not found: Error: Can't resolve 'fs'
Environment
npx create-react-app --info
Environment Info:
Steps to reproduce
In a project with react-scripts v5.0.0
Expected behavior
Actual behavior
Some useful comments: