Created
May 2, 2022 22:56
-
-
Save 0xmovses/5262d75cb20a2cec8ef787f97ed8872b to your computer and use it in GitHub Desktop.
webpack 5 overrides
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//install react-app-rewired and all the broswerify packages | |
const webpack = require('webpack'); | |
module.exports = function override(config) { | |
const fallback = config.resolve.fallback || {}; | |
Object.assign(fallback, { | |
"crypto": require.resolve("crypto-browserify"), | |
"stream": require.resolve("stream-browserify"), | |
"assert": require.resolve("assert"), | |
"http": require.resolve("stream-http"), | |
"https": require.resolve("https-browserify"), | |
"os": require.resolve("os-browserify"), | |
"url": require.resolve("url") | |
}) | |
config.resolve.fallback = fallback; | |
config.plugins = (config.plugins || []).concat([ | |
new webpack.ProvidePlugin({ | |
process: 'process/browser', | |
Buffer: ['buffer', 'Buffer'] | |
}) | |
]) | |
return config; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment