Skip to content

Instantly share code, notes, and snippets.

@0xmovses
Created May 2, 2022 22:56
Show Gist options
  • Save 0xmovses/5262d75cb20a2cec8ef787f97ed8872b to your computer and use it in GitHub Desktop.
Save 0xmovses/5262d75cb20a2cec8ef787f97ed8872b to your computer and use it in GitHub Desktop.
webpack 5 overrides
//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