Skip to content

Commit

Permalink
feat: support disabling preserveDynamicImports (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendonmatos authored Oct 30, 2023
1 parent fa3cabb commit 2e487c3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ async function _build(
emitCJS: false,
cjsBridge: false,
inlineDependencies: false,
preserveDynamicImports: true,
// Plugins
replace: {
preventAssignment: true,
Expand Down
3 changes: 1 addition & 2 deletions src/builder/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ export function getRollupOptions(ctx: BuildContext): RollupOptions {
...ctx.options.rollup.commonjs,
}),

// Preserve dynamic imports for CommonJS
{
ctx.options.rollup.preserveDynamicImports && {
renderDynamicImport() {
return { left: "import(", right: ")" };
},
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export type BuildEntry =
export interface RollupBuildOptions {
emitCJS?: boolean;
cjsBridge?: boolean;
preserveDynamicImports?: boolean;
inlineDependencies?: boolean;
output?: OutputOptions;
// Plugins
Expand Down

0 comments on commit 2e487c3

Please sign in to comment.