From fca43f436221d379f5c7eccd5c3d08a4555fb179 Mon Sep 17 00:00:00 2001 From: William Chargin Date: Mon, 30 Jul 2018 16:26:13 -0700 Subject: [PATCH] new-webpack: allow running in dev (#565) Summary: In addition to simply disabling the prod-only check, we apply a workaround for a known bug that breaks static site generation in Webpack versions >= 2.0. Test Plan: Run ``` NODE_ENV=development node ./node_modules/.bin/webpack-dev-server \ --config config/makeWebpackConfig.js ``` and visit http://localhost:8080/webpack-dev-server/ (note the trailing slash) or just http://localhost:8080/. Expect the server to be slow, as it is actually building for production. wchargin-branch: webpack-enable-dev --- config/makeWebpackConfig.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/config/makeWebpackConfig.js b/config/makeWebpackConfig.js index d1f7084..60f45d5 100644 --- a/config/makeWebpackConfig.js +++ b/config/makeWebpackConfig.js @@ -21,15 +21,6 @@ const publicUrl = publicPath.slice(0, -1); // Get environment variables to inject into our app. const env = getClientEnvironment(publicUrl); -// Assert this just to be safe. -// Development builds of React are slow and not intended for production. -if (env.stringified["process.env"].NODE_ENV !== '"production"') { - throw new Error("Production builds must have NODE_ENV=production."); -} - -// This is the production configuration. -// It compiles slowly and is focused on producing a fast and minimal bundle. -// The development configuration is different and lives in a separate file. function makeConfig(_unused_mode /*: "production" | "development" */) { return { // Don't attempt to continue if there are any errors. @@ -45,6 +36,9 @@ function makeConfig(_unused_mode /*: "production" | "development" */) { paths.appServerSideRenderingIndexJs, ], }, + devServer: { + inline: false, + }, output: { // The build folder. path: paths.appBuild,