From e0e8c35e1e21e9cb95917f3c74d154ccf1b1753a Mon Sep 17 00:00:00 2001 From: Jens Meindertsma Date: Sat, 12 Sep 2020 17:32:57 +0200 Subject: [PATCH 1/3] Provide object to `environment` --- packages/next/build/webpack-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 1b1bdfa5a3b6e..369e85cb98af4 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -790,7 +790,7 @@ export default async function getBaseWebpackConfig( ignored: ['**/.git/**', '**/node_modules/**', '**/.next/**'], }, output: { - ...(isWebpack5 ? { environment: 5 } : {}), + ...(isWebpack5 ? { environment: {} } : {}), path: outputPath, // On the server we don't use the chunkhash filename: isServer From 797226c2d3832eea718b5fd90b40782be1343b8b Mon Sep 17 00:00:00 2001 From: Jens Meindertsma Date: Sat, 12 Sep 2020 18:24:00 +0200 Subject: [PATCH 2/3] Add configuration for ES5 target --- packages/next/build/webpack-config.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 369e85cb98af4..8b6463fd688cd 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -790,7 +790,9 @@ export default async function getBaseWebpackConfig( ignored: ['**/.git/**', '**/node_modules/**', '**/.next/**'], }, output: { - ...(isWebpack5 ? { environment: {} } : {}), + ...(isWebpack5 + ? { environment: { arrowFunction: false, const: false, forOf: false } } + : {}), path: outputPath, // On the server we don't use the chunkhash filename: isServer From 03df8538d542553a9e1b4403117fe7a79791f71c Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Sun, 13 Sep 2020 15:03:43 +0200 Subject: [PATCH 3/3] Fix environment config --- packages/next/build/webpack-config.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index 8b6463fd688cd..8f9753d16796e 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -791,7 +791,17 @@ export default async function getBaseWebpackConfig( }, output: { ...(isWebpack5 - ? { environment: { arrowFunction: false, const: false, forOf: false } } + ? { + environment: { + arrowFunction: false, + bigIntLiteral: false, + const: false, + destructuring: false, + dynamicImport: false, + forOf: false, + module: false, + }, + } : {}), path: outputPath, // On the server we don't use the chunkhash