score:2
It's about Webpack 5 and its default config you use for React app. I followed an advice from here: https://github.com/nrwl/nx/issues/4817#issuecomment-824316899 and React NX docs for how to use custom webpack config.
Create a custom webpack config, say, in /apps/myapp/webpack.config.js and reference it in workspace.json
instead of "webpackConfig": "@nrwl/react/plugins/webpack"
. It should be "webpackConfig": "apps/myapp/webpack.config.js"
.
Content for webpack.config.js
:
const nrwlConfig = require("@nrwl/react/plugins/webpack.js");
module.exports = (config, context) => {
// first call it so that @nrwl/react plugin adds its configs
nrwlConfig(config);
return {
...config,
node: undefined
};
};
So, this config change makes webpack correctly understand what polyfills are needed.
Alternatively, you can do the following:
const nrwlConfig = require("@nrwl/react/plugins/webpack.js");
module.exports = (config, context) => {
// first call it so that @nrwl/react plugin adds its configs
nrwlConfig(config);
return {
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
stream: require.resolve('stream-browserify'),
zlib: require.resolve('browserify-zlib'),
}
}
};
};
Source: stackoverflow.com
Related Query
- How to fix this error : " Module not found :can't resolve popper.js "
- How to resolve module not found error in webpack/reactjs app?
- "module not found : Error: Cannot resolve module 'react/lib/ReactMount' "
- How to fix Next.js Vercel deployment module not found error
- Module not found Error when deployed on Heroku
- Typescript Module not found Can't resolve
- Module not found Error: Can't resolve 'history' in @types/history
- Firebase-Admin, importing it to react application throws Module not found error
- why do i get the Error Module not found: Can't resolve 'redux'
- Cannot resolve module "firebase" from 'firebase.js' : Firebase could not be found within the project
- Module not found error using Yarn 2 to link React components
- ERROR in Entry module not found: Error: Can't resolve 'babel-loader'
- Error in Entry Module not found - in Webpack Config file
- Webpack: ERROR in ./src/index.tsx Module not found: Error: Can't resolve './App' in '...'
- how to solve the error that fs module is not found when used react and next.js
- `react-map-gl` ERROR Module not found error [MAPBOX]
- Getting the error : Module not found: Can't resolve 'firebase/app'
- Module not found: Error: Can't resolve 'crypto' and Cant resolve 'fs'
- Module not found, Cant resolve serviceWorker in 'React'
- bcrypt, sequelize ERROR in ../node_modules/node-pre-gyp/lib/publish.js Module not found: Error: Can't resolve 'aws-sdk'
- ERROR in ./src/App.jsx Module not found: Error: Can't resolve './component/Footer'
- Webpack ERROR Module not found
- webpack: ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' .jsx
- fbt internationalization: ERROR in ./src/example/Example.react.js Module not found: Error: Can't resolve 'fbt'
- Can't resolve module not found in React.js
- Why do I get this error - Compiled with problems: Module not found: Error: Can't resolve 'react-top-loading-bar' while installing top-loading-bar
- Module Not Found Error while Pushing to Heroku
- Module not found Can't resolve react-scroll-to-bottom
- Module not found: Can't resolve ' ./Navbar' error when compiling in react
- Webpack stopped working after refactoring: ERROR in Entry module not found
More Query from same tag
- How to concatenate first name and last name in ReactJS?
- How to use custom react query hook twice in the same component?
- How to approach this.state is undefined issue in React?
- React Best Practices: Where to *not* render a component?
- Typescript React Error
- Programatically navigate to a different route and pass query
- Changing time according to TimeZone in React
- React: clear input item after click doesn't work
- React UseState is called twice inside eventListener
- Best way to disable edit on lines (via ArrayInput/SimpleFormIterator)?
- What is the idiomatic way to create styles for a Reason-React component that depend on props?
- MobX changing but not rerendering components
- How to validate firebase user current password
- How to post data from CKEditor to json server in React
- Typescript and react - Object is possibly 'null'
- How to stop adding duplicate data to Array in react.js
- React & Typescript: 'JSX' is not defined no-undef
- Not able to register through frontend. Keeps saying Bad Request
- React onKeyDown/onKeyUp events on non-input elements
- React Js : Unable to login until page gets refresh manually
- React Router: How to match indeterminate amount of sub paths of a nested route?
- React element incorrectly changes position when adding text
- Running react-scripts app with input from another server
- Loop of async calls not awaiting to solve
- ReactJs how to access to DOM element
- Stopping event propagation in Reactjs
- Amcharts 4 : Disable single legend item programmatically
- How to pass props via an object
- Is it possible to use Flow and arrow functions with React?
- styled-components and TS2769: No overload matches this call