Skip to content

Commit

Permalink
fix(react): SWC compiled code should include react jsx runtime (#10220)
Browse files Browse the repository at this point in the history
Fixes #8869
  • Loading branch information
jaysoo committed May 9, 2022
1 parent 6e10769 commit 23f6d54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions e2e/web/src/web.test.ts
Expand Up @@ -93,6 +93,11 @@ describe('Web Components Applications', () => {
);
checkFilesExist(`dist/apps/_should_not_remove.txt`);

// Asset that React runtime is imported
expect(readFile(`dist/libs/${libName}/index.esm.js`)).toMatch(
/react\/jsx-runtime/
);

// `delete-output-path`
createFile(`dist/apps/${appName}/_should_keep.txt`);
runCLI(`build ${appName} --delete-output-path=false --outputHashing none`);
Expand Down
5 changes: 5 additions & 0 deletions packages/web/src/executors/rollup/lib/swc-plugin.ts
Expand Up @@ -7,6 +7,11 @@ export function swc(): Plugin {
transform(code, filename) {
return transform(code, {
filename,
jsc: {
transform: {
react: { runtime: 'automatic' },
},
},
});
},
};
Expand Down

0 comments on commit 23f6d54

Please sign in to comment.