From 9826570b64bd840a8ea54cdbce9344287013f41e Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Fri, 30 Oct 2020 08:46:01 -0600 Subject: [PATCH] Fix vscode + eslint hanging (#4198) * only add webpack devserver config in development mode, to avoid running out of ports * Use undefined instead of null for absent webpack config value --- src-docs/webpack.config.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src-docs/webpack.config.js b/src-docs/webpack.config.js index ee5eda0c10f..10d86588a8b 100644 --- a/src-docs/webpack.config.js +++ b/src-docs/webpack.config.js @@ -7,9 +7,9 @@ const babelConfig = require('./.babelrc.js'); const getPort = require('get-port'); const deasync = require('deasync'); -const { NODE_ENV, CI } = process.env; +const { NODE_ENV, CI, WEBPACK_DEV_SERVER } = process.env; -const isDevelopment = NODE_ENV !== 'production' && CI == null; +const isDevelopment = WEBPACK_DEV_SERVER === 'true' && CI == null; const isProduction = NODE_ENV === 'production'; const bypassCache = NODE_ENV === 'puppeteer'; @@ -124,14 +124,19 @@ const webpackConfig = { // }), ], - devServer: { - contentBase: 'src-docs/build', - host: '0.0.0.0', - allowedHosts: ['*'], - port: getPortSync({ port: getPort.makeRange(8030, 8130), host: '0.0.0.0' }), - disableHostCheck: true, - historyApiFallback: true, - }, + devServer: isDevelopment + ? { + contentBase: 'src-docs/build', + host: '0.0.0.0', + allowedHosts: ['*'], + port: getPortSync({ + port: getPort.makeRange(8030, 8130), + host: '0.0.0.0', + }), + disableHostCheck: true, + historyApiFallback: true, + } + : undefined, node: { fs: 'empty', },