parent
785ada4567
commit
333b0e60eb
@ -1,17 +1,31 @@ |
||||
const nxWebpack = require('@nrwl/react/plugins/webpack') |
||||
const TerserPlugin = require('terser-webpack-plugin') |
||||
|
||||
module.exports = config => { |
||||
const nxWebpackConfig = nxWebpack(config) |
||||
const nxWebpackConfig = nxWebpack(config) |
||||
const webpackConfig = { |
||||
...nxWebpackConfig, |
||||
node: { |
||||
fs: 'empty', |
||||
tls: 'empty', |
||||
readline: 'empty', |
||||
net: 'empty', |
||||
module: 'empty', |
||||
child_process: 'empty' |
||||
} |
||||
} |
||||
|
||||
if (process.env.NODE_ENV === 'production') { |
||||
return { |
||||
...nxWebpackConfig, |
||||
node: { |
||||
fs: 'empty', |
||||
tls: 'empty', |
||||
readline: 'empty', |
||||
net: 'empty', |
||||
module: 'empty', |
||||
child_process: 'empty' |
||||
} |
||||
...webpackConfig, |
||||
mode: 'production', |
||||
devtool: 'source-map', |
||||
optimization: { |
||||
minimize: true, |
||||
minimizer: [new TerserPlugin()] |
||||
} |
||||
} |
||||
} else { |
||||
return webpackConfig |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue