diff --git a/packages/run/test/fixtures/dynamic.js b/packages/run/test/fixtures/dynamic.js new file mode 100644 index 000000000..c6463f84c --- /dev/null +++ b/packages/run/test/fixtures/dynamic.js @@ -0,0 +1,2 @@ +import { log } from './log.js'; +log(0) diff --git a/packages/run/test/fixtures/input-with-dynamic.js b/packages/run/test/fixtures/input-with-dynamic.js new file mode 100644 index 000000000..6ae636ab5 --- /dev/null +++ b/packages/run/test/fixtures/input-with-dynamic.js @@ -0,0 +1,5 @@ +import { log } from "./log.js"; +log(0); +(async () => { + await import("./dynamic.js"); +})(); diff --git a/packages/run/test/fixtures/log.js b/packages/run/test/fixtures/log.js new file mode 100644 index 000000000..bc12ab398 --- /dev/null +++ b/packages/run/test/fixtures/log.js @@ -0,0 +1 @@ +export const log = value => console.log(value); diff --git a/packages/run/test/test.js b/packages/run/test/test.js index a20e1441b..d8ce23196 100644 --- a/packages/run/test/test.js +++ b/packages/run/test/test.js @@ -83,6 +83,16 @@ test('detects changes - forks a new child process and kills older process', asyn t.is(mockChildProcess().kill.callCount, 1); }); +test.only('works when chunk is use in entry and dynamic import', async (t) => { + const bundle = await rollup({ + input: join(cwd, 'input-with-dynamic.js'), + plugins: [run()] + }); + await t.notThrowsAsync(async () => { + await bundle.write({ dir: join(cwd, 'output'), format: 'cjs' }); + }); +}); + test.after(async () => { await del(['output']); });