diff --git a/packages/next/taskfile-swc.js b/packages/next/taskfile-swc.js index 45e985cb7cc6..52e2ce34ccaa 100644 --- a/packages/next/taskfile-swc.js +++ b/packages/next/taskfile-swc.js @@ -117,7 +117,7 @@ module.exports = function (task) { if (output.map) { if (interopClientDefaultExport) { output.code += ` -if (typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) { +if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') { Object.defineProperty(exports.default, '__esModule', { value: true }); Object.assign(exports.default, exports); module.exports = exports.default; diff --git a/test/production/jest/index.test.ts b/test/production/jest/index.test.ts index 79f055b3a5ec..e7a8e09d748d 100644 --- a/test/production/jest/index.test.ts +++ b/test/production/jest/index.test.ts @@ -21,10 +21,12 @@ describe('next/jest', () => { return

Hello Dynamic

; } `, + 'styles/index.module.css': '.home { color: orange }', 'pages/index.js': ` import dynamic from "next/dynamic"; import Image from "next/image"; import img from "../public/vercel.svg"; + import styles from "../styles/index.module.css"; const Comp = dynamic(() => import("../components/comp"), { loading: () =>

Loading...

, @@ -35,7 +37,7 @@ describe('next/jest', () => { logo logo 2 -

hello world

+

hello world

} `,