Remove HMR config from production webpack configuration.

This commit is contained in:
Dillon Kearns 2020-01-04 19:09:25 -08:00
parent 48d19ddc72
commit c846c9ff25

View File

@ -121,10 +121,6 @@ function webpackOptions(
{ debug, manifestConfig, routesWithRequests } { debug, manifestConfig, routesWithRequests }
) { ) {
const common = { const common = {
entry: [
require.resolve("webpack-hot-middleware/client"),
path.resolve(process.cwd(), "./index.js"),
],
mode: production ? "production" : "development", mode: production ? "production" : "development",
plugins: [ plugins: [
new AddFilesPlugin(routesWithRequests), new AddFilesPlugin(routesWithRequests),
@ -273,6 +269,7 @@ function webpackOptions(
}; };
if (production) { if (production) {
return merge(common, { return merge(common, {
entry: "./index.js",
optimization: { optimization: {
minimizer: [ minimizer: [
new ClosurePlugin( new ClosurePlugin(
@ -322,6 +319,10 @@ function webpackOptions(
}); });
} else { } else {
return merge(common, { return merge(common, {
entry: [
require.resolve("webpack-hot-middleware/client"),
"./index.js",
],
plugins: [ plugins: [
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
// Prevents compilation errors causing the hot loader to lose state // Prevents compilation errors causing the hot loader to lose state