From 856c9a2bbea9c9a48a05c0df042a698a7a38aad2 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 11 May 2021 19:40:07 -0500 Subject: [PATCH 1/2] Fix ie11 support with webpack 5 --- packages/next/build/webpack-config.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index b19dbf1135219..966f8f23f3404 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -503,7 +503,7 @@ export default async function getBaseWebpackConfig( // and all other chunk depend on them so there is no // duplication that need to be pulled out. chunks: isWebpack5 - ? (chunk) => !/^(main|pages\/_app)$/.test(chunk.name) + ? (chunk) => !/^(polyfills|main|pages\/_app)$/.test(chunk.name) : 'all', cacheGroups: { framework: { @@ -1624,7 +1624,12 @@ export default async function getBaseWebpackConfig( if (isWebpack5 && !isServer) { for (const name of Object.keys(entry)) { - if (name === 'main' || name === 'amp' || name === 'react-refresh') + if ( + name === 'polyfills' || + name === 'main' || + name === 'amp' || + name === 'react-refresh' + ) continue const dependOn = name.startsWith('pages/') && name !== 'pages/_app' From cc32bffc7f3c8c6a72460c36a760518192bd3ff9 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Tue, 11 May 2021 19:54:27 -0500 Subject: [PATCH 2/2] fix hrefValue test on windows --- .../eslint-plugin-next/lib/rules/google-font-display.js | 6 +++--- .../eslint-plugin-next/lib/rules/google-font-preconnect.js | 3 ++- .../eslint-plugin-next/lib/rules/no-page-custom-font.js | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/eslint-plugin-next/lib/rules/google-font-display.js b/packages/eslint-plugin-next/lib/rules/google-font-display.js index 2f96363c7bb29..d59dde1021fc4 100644 --- a/packages/eslint-plugin-next/lib/rules/google-font-display.js +++ b/packages/eslint-plugin-next/lib/rules/google-font-display.js @@ -23,9 +23,9 @@ module.exports = { } const hrefValue = attributes.value('href') - const isGoogleFont = hrefValue?.startsWith( - 'https://fonts.googleapis.com/css' - ) + const isGoogleFont = + typeof hrefValue === 'string' && + hrefValue.startsWith('https://fonts.googleapis.com/css') if (isGoogleFont) { const params = new URLSearchParams(hrefValue.split('?')[1]) diff --git a/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js b/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js index 931ad7ad87cf8..6d5aed8bcc431 100644 --- a/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js +++ b/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js @@ -26,7 +26,8 @@ module.exports = { attributes.value('rel') !== 'preconnect' if ( - hrefValue?.startsWith('https://fonts.gstatic.com') && + typeof hrefValue === 'string' && + hrefValue.startsWith('https://fonts.gstatic.com') && preconnectMissing ) { context.report({ diff --git a/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js b/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js index ab295a2682d68..807afb21a60ee 100644 --- a/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js +++ b/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js @@ -38,9 +38,9 @@ module.exports = { } const hrefValue = attributes.value('href') - const isGoogleFont = hrefValue?.startsWith( - 'https://fonts.googleapis.com/css' - ) + const isGoogleFont = + typeof hrefValue === 'string' && + hrefValue.startsWith('https://fonts.googleapis.com/css') if (isGoogleFont) { context.report({