You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/** @returns {import('webpack').Configuration} Webpack Configuration */
|
|
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
|
var webpack = require('webpack')
|
|
|
|
module.exports = (config, { mode }) => {
|
|
if (mode === 'development') {
|
|
// Add dev plugin
|
|
}
|
|
|
|
config.module.rules.push({
|
|
resolve: {
|
|
fallback: {
|
|
fs: false,
|
|
path: require.resolve('path-browserify'),
|
|
http: require.resolve('stream-http'),
|
|
https: require.resolve('https-browserify'),
|
|
zlib: require.resolve('browserify-zlib'),
|
|
stream: require.resolve('stream-browserify'),
|
|
querystring: require.resolve('querystring-es3')
|
|
},
|
|
},
|
|
})
|
|
|
|
config.plugins.push(
|
|
// fix "process is not defined" error:
|
|
// (do "npm install process" before running the build)
|
|
new webpack.ProvidePlugin({
|
|
process: 'process/browser.js',
|
|
Buffer: ['buffer', 'Buffer'],
|
|
})
|
|
)
|
|
|
|
// Add custom rules for your project
|
|
// config.module.rules.push(YOUR_RULE)
|
|
|
|
// Add custom plugins for your project
|
|
// config.plugins.push(YOUR_PLUGIN)
|
|
|
|
return config
|
|
}
|