|
|
|
@ -1,17 +1,21 @@ |
|
|
|
|
const nxWebpack = require('@nrwl/react/plugins/webpack') |
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin') |
|
|
|
|
|
|
|
|
|
module.exports = config => { |
|
|
|
|
const nxWebpackConfig = nxWebpack(config) |
|
|
|
|
const webpackConfig = { |
|
|
|
|
...nxWebpackConfig, |
|
|
|
|
node: { |
|
|
|
|
fs: 'empty', |
|
|
|
|
tls: 'empty', |
|
|
|
|
readline: 'empty', |
|
|
|
|
net: 'empty', |
|
|
|
|
module: 'empty', |
|
|
|
|
child_process: 'empty' |
|
|
|
|
resolve : { |
|
|
|
|
...nxWebpackConfig.resolve, |
|
|
|
|
fallback: { |
|
|
|
|
...nxWebpackConfig.resolve.fallback, |
|
|
|
|
"crypto": require.resolve("crypto-browserify"), |
|
|
|
|
"stream": require.resolve("stream-browserify"), |
|
|
|
|
"http" : require.resolve("stream-http"), |
|
|
|
|
"https" : require.resolve("https-browserify"), |
|
|
|
|
"path" : require.resolve("path-browserify"), |
|
|
|
|
"module": false, |
|
|
|
|
"fs" : false |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -20,10 +24,6 @@ module.exports = config => { |
|
|
|
|
...webpackConfig, |
|
|
|
|
mode: 'production', |
|
|
|
|
devtool: 'source-map', |
|
|
|
|
optimization: { |
|
|
|
|
minimize: true, |
|
|
|
|
minimizer: [new TerserPlugin()] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return webpackConfig |
|
|
|
|