From 7ce000b328305737099549bc186ddd3a39a2528b Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Wed, 17 Jun 2020 08:59:00 -0400 Subject: [PATCH] WSL should be considered Windows for HMR option (#14254) This toggles the separate Windows `devtool` setting for WSL. We cannot test this as we do not have access to WSL in our current test setup suite, however, this is a temporary patch that should be fixed with the webpack 5 upgrade, so I do not feel strongly about testing it. --- Fixes #14253 --- packages/next/build/webpack/config/blocks/base.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack/config/blocks/base.ts b/packages/next/build/webpack/config/blocks/base.ts index b55b901c67..386a303694 100644 --- a/packages/next/build/webpack/config/blocks/base.ts +++ b/packages/next/build/webpack/config/blocks/base.ts @@ -1,7 +1,10 @@ +import isWslBoolean from 'next/dist/compiled/is-wsl' import curry from 'next/dist/compiled/lodash.curry' import { Configuration } from 'webpack' import { ConfigurationContext } from '../utils' +const isWindows = process.platform === 'win32' || isWslBoolean + export const base = curry(function base( ctx: ConfigurationContext, config: Configuration @@ -19,7 +22,7 @@ export const base = curry(function base( if (ctx.isDevelopment) { if (process.env.__NEXT_TEST_MODE && !process.env.__NEXT_TEST_WITH_DEVTOOL) { config.devtool = false - } else if (process.platform === 'win32') { + } else if (isWindows) { // Non-eval based source maps are slow to rebuild, so we only enable // them for Windows. Unfortunately, eval source maps are flagged as // suspicious by Windows Defender and block HMR. -- GitLab