Skip to content

Commit

Permalink
fix(rollup): add interopDefault for jiti stub
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Sep 21, 2021
1 parent 1576cb6 commit b1bf926
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builder/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export async function rollupBuild (ctx: BuildContext) {
if (ctx.stub) {
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')()('${entry.input}')`)
await writeFile(output + '.mjs', `import jiti from 'jiti';\nexport default jiti()('${entry.input}');`)
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 + '.d.ts', `export * from '${entry.input}'`)
}
return
Expand Down

0 comments on commit b1bf926

Please sign in to comment.