Skip to content

Commit 0a8a2f8

Browse files
committed
fix(rsc): fix cjs module runner default import
1 parent 9da2c98 commit 0a8a2f8

File tree

1 file changed

+4
-1
lines changed
  • packages/plugin-rsc/src/plugins

1 file changed

+4
-1
lines changed

packages/plugin-rsc/src/plugins/cjs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ export function cjsModuleRunnerPlugin(): Plugin[] {
5656
// TODO: can we use cjs-module-lexer to properly define named exports?
5757
// for re-exports, we need to eagerly transform dependencies though.
5858
// https://github.com/nodejs/node/blob/f3adc11e37b8bfaaa026ea85c1cf22e3a0e29ae9/lib/internal/modules/esm/translators.js#L382-L409
59-
output.append(`__vite_ssr_exportAll__(module.exports)`)
59+
output.append(`
60+
;__vite_ssr_exportAll__(module.exports);
61+
export default module.exports;
62+
`)
6063
return {
6164
code: output.toString(),
6265
map: output.generateMap({ hires: 'boundary' }),

0 commit comments

Comments
 (0)