diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 84c1f60be6bc5..4505fefc7b33f 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -218,7 +218,7 @@ export const defaultConfig: NextConfig = { disableOptimizedLoading: false, gzipSize: true, craCompat: false, - esmExternals: false, + esmExternals: true, staticPageGenerationTimeout: 60, // default to 50MB limit isrMemoryCacheSize: 50 * 1024 * 1024, diff --git a/test/integration/externals/next.config.js b/test/integration/externals/next.config.js deleted file mode 100644 index 826c3454030d2..0000000000000 --- a/test/integration/externals/next.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - webpack(config) { - config.resolve.alias = { - ...config.resolve.alias, - 'preact/compat': 'react', - } - - return config - }, -} diff --git a/test/integration/externals/node_modules/esm-package/correct.js b/test/integration/externals/node_modules/esm-package/correct.js deleted file mode 100644 index cea6b73e3b7b1..0000000000000 --- a/test/integration/externals/node_modules/esm-package/correct.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'World' diff --git a/test/integration/externals/node_modules/esm-package/package.json b/test/integration/externals/node_modules/esm-package/package.json deleted file mode 100644 index 307908751781d..0000000000000 --- a/test/integration/externals/node_modules/esm-package/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "esm-package", - "exports": { - "./entry": { - "import": "./wrong.mjs", - "require": "./correct.js" - } - } -} diff --git a/test/integration/externals/node_modules/esm-package/wrong.mjs b/test/integration/externals/node_modules/esm-package/wrong.mjs deleted file mode 100644 index 61f4f6857e2f1..0000000000000 --- a/test/integration/externals/node_modules/esm-package/wrong.mjs +++ /dev/null @@ -1,3 +0,0 @@ -if(typeof window === "undefined") - throw new Error("This shouldn't be used on server-side") -export default "World"; diff --git a/test/integration/externals/node_modules/module-package/correct.js b/test/integration/externals/node_modules/module-package/correct.js deleted file mode 100644 index cea6b73e3b7b1..0000000000000 --- a/test/integration/externals/node_modules/module-package/correct.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = 'World' diff --git a/test/integration/externals/node_modules/module-package/package.json b/test/integration/externals/node_modules/module-package/package.json deleted file mode 100644 index 0fb9324a02f50..0000000000000 --- a/test/integration/externals/node_modules/module-package/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "module-package", - "exports": { - ".": { - "module": "./wrong.mjs", - "import": "./wrong.mjs", - "require": "./correct.js" - } - } -} diff --git a/test/integration/externals/node_modules/module-package/wrong.mjs b/test/integration/externals/node_modules/module-package/wrong.mjs deleted file mode 100644 index 61f4f6857e2f1..0000000000000 --- a/test/integration/externals/node_modules/module-package/wrong.mjs +++ /dev/null @@ -1,3 +0,0 @@ -if(typeof window === "undefined") - throw new Error("This shouldn't be used on server-side") -export default "World"; diff --git a/test/integration/externals/node_modules/preact/compat.js b/test/integration/externals/node_modules/preact/compat.js deleted file mode 100644 index 41152fe16598d..0000000000000 --- a/test/integration/externals/node_modules/preact/compat.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error('Should not be executed') diff --git a/test/integration/externals/pages/ssg.js b/test/integration/externals/pages/ssg.js deleted file mode 100644 index 51e9724dd0627..0000000000000 --- a/test/integration/externals/pages/ssg.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'preact/compat' -import World1 from 'esm-package/entry' -import World2 from 'module-package' - -export async function getStaticProps() { - return { - props: {}, - } -} - -export default function Index(props) { - return ( -