fix: Remove HMR in test env (#2054)

This commit is contained in:
Tom Moor 2021-04-21 17:53:53 -07:00 committed by GitHub
parent a134773d4e
commit 50fdd73610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -3,6 +3,8 @@ const webpack = require("webpack");
const commonWebpackConfig = require("./webpack.config");
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const isTest = process.env.NODE_ENV === "test";
const developmentWebpackConfig = Object.assign(commonWebpackConfig, {
cache: true,
mode: "development",
@ -16,14 +18,16 @@ const developmentWebpackConfig = Object.assign(commonWebpackConfig, {
},
});
developmentWebpackConfig.plugins = [
...developmentWebpackConfig.plugins,
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin({
overlay: {
sockIntegration: 'whm',
},
}),
];
if (!isTest) {
developmentWebpackConfig.plugins = [
...developmentWebpackConfig.plugins,
new webpack.HotModuleReplacementPlugin(),
new ReactRefreshWebpackPlugin({
overlay: {
sockIntegration: 'whm',
},
}),
];
}
module.exports = developmentWebpackConfig;