Skip to content

Commit

Permalink
fix: avoid interopDefault for esm stub
Browse files Browse the repository at this point in the history
or it will give different behavior between stub and bundle
  • Loading branch information
pi0 committed Sep 21, 2021
1 parent ab86915 commit 6a36080
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/builder/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export async function rollupBuild (ctx: BuildContext) {
for (const entry of ctx.entries.filter(entry => entry.builder === 'rollup')) {
const output = resolve(ctx.rootDir, ctx.outDir, entry.name)
await writeFile(output + '.cjs', `module.exports = require('jiti')(null, { interopDefault: true })('${entry.input}')`)
await writeFile(output + '.mjs', `import jiti from 'jiti';\nexport default jiti(null, { interopDefault: true })('${entry.input}');`)
await writeFile(output + '.mjs', `import jiti from 'jiti';\nexport default jiti()('${entry.input}');`)
await writeFile(output + '.d.ts', `export * from '${entry.input}'`)
}
return
Expand Down

0 comments on commit 6a36080

Please sign in to comment.