Commit 7902ac43 authored by gxkai's avatar gxkai

fix: hmr

parent e3dcdd3f
const nxWebpack = require('@nrwl/react/plugins/webpack') const nxWebpack = require('@nrwl/react/plugins/webpack')
const TerserPlugin = require('terser-webpack-plugin')
const webpack = require('webpack')
const WebpackBar = require('webpackbar') const WebpackBar = require('webpackbar')
module.exports = config => { module.exports = config => {
const nxWebpackConfig = nxWebpack(config) const nxWebpackConfig = nxWebpack(config)
...@@ -16,16 +14,6 @@ module.exports = config => { ...@@ -16,16 +14,6 @@ module.exports = config => {
} }
} }
webpackConfig.plugins.push(new WebpackBar()) webpackConfig.plugins.push(new WebpackBar())
// webpackConfig.resolve.alias = {
// ...webpackConfig.resolve.alias,
// 'fs': 'browserfs/dist/shims/fs.js',
// 'buffer': 'browserfs/dist/shims/buffer.js',
// 'path': 'browserfs/dist/shims/path.js',
// 'processGlobal': 'browserfs/dist/shims/process.js',
// 'bufferGlobal': 'browserfs/dist/shims/bufferGlobal.js',
// 'bfsGlobal': require.resolve('browserfs')
// }
// webpackConfig.plugins.push(new webpack.ProvidePlugin({ BrowserFS: 'bfsGlobal', process: 'processGlobal', Buffer: 'bufferGlobal' }))
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
const CompressionPlugin = require('compression-webpack-plugin') const CompressionPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol'] const productionGzipExtensions = ['js', 'css', 'svg', 'ttf', 'otf', 'eot', 'woff', 'woff2', 'webp', 'png', 'sol']
...@@ -39,16 +27,12 @@ module.exports = config => { ...@@ -39,16 +27,12 @@ module.exports = config => {
})) }))
return { return {
...webpackConfig ...webpackConfig
// mode: 'production',
// devtool: 'nosources-cheap-module-source-map',
// optimization: {
// minimize: true,
// minimizer: [new TerserPlugin({
// parallel: false
// })]
// }
} }
} else { } else {
webpackConfig.devServer = {
...webpackConfig.devServer,
hot: true
}
return webpackConfig return webpackConfig
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment