Skip to content

Commit

Permalink
fix inlineDynamicImports entry misrecognition bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Jun 4, 2018
1 parent 649a046 commit a7058a6
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ export default class Graph {
const { orderedModules, dynamicImports, dynamicImportAliases } = this.analyseExecution(
entryModules,
!preserveModules && !inlineDynamicImports,
inlineDynamicImports,
manualChunkModules
);

Expand Down Expand Up @@ -512,6 +513,7 @@ export default class Graph {
private analyseExecution(
entryModules: Module[],
graphColouring: boolean,
inlineDynamicImports: boolean,
chunkModules?: Record<string, Module[]>
) {
let curEntry: Module, curEntryHash: Uint8Array;
Expand Down Expand Up @@ -603,7 +605,7 @@ Try defining "${chunkName}" first in the manualChunks definitions of the Rollup
// new items can be added during this loop
for (curEntry of dynamicImports) {
if (curEntry.isEntryPoint) continue;
curEntry.isEntryPoint = true;
if (!inlineDynamicImports) curEntry.isEntryPoint = true;
curEntryHash = randomUint8Array(10);
parents = { [curEntry.id]: null };
visit(curEntry);
Expand Down
6 changes: 6 additions & 0 deletions test/form/samples/dynamic-import-inlining/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
description: 'dynamic import inlining',
options: {
experimentalDynamicImport: true
}
};
10 changes: 10 additions & 0 deletions test/form/samples/dynamic-import-inlining/_expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const foo = 1;

var foo$1 = /*#__PURE__*/Object.freeze({
foo: foo
});

const bar = 2;
Promise.resolve().then(function () { return foo; });

export { bar };
1 change: 1 addition & 0 deletions test/form/samples/dynamic-import-inlining/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const foo = 1;
3 changes: 3 additions & 0 deletions test/form/samples/dynamic-import-inlining/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { foo } from './foo.js';
export const bar = 2
import('./foo.js')

0 comments on commit a7058a6

Please sign in to comment.