Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interopDefault on jest object-proxy #37002

Merged
merged 2 commits into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/taskfile-swc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
ijjk marked this conversation as resolved.
Show resolved Hide resolved
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
Expand Down
4 changes: 3 additions & 1 deletion test/production/jest/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ describe('next/jest', () => {
return <h1>Hello Dynamic</h1>;
}
`,
'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: () => <h1>Loading...</h1>,
Expand All @@ -35,7 +37,7 @@ describe('next/jest', () => {
<Comp />
<Image src={img} alt="logo" placeholder="blur"/>
<Image src={img} alt="logo 2"/>
<p>hello world</p>
<p className={styles.home}>hello world</p>
</>
}
`,
Expand Down