Skip to content

Commit

Permalink
test: add failing test for rollup issue 2659
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Jan 16, 2019
1 parent 7557b82 commit 9363416
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/rollup/test/specimens/stripped-dynamic-imports/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if(false) {
import("./b.js").then(console.log);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default "hi";
29 changes: 28 additions & 1 deletion packages/rollup/test/splitting.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,33 @@ describe("/rollup.js", () => {
expect(dir("./dynamic-imports/assets/")).toMatchSnapshot();
});

it("shouldn't break when dynamic imports are tree-shaken away (rollup/rollup#2659)", async () => {
const bundle = await rollup({
input : [
require.resolve("./specimens/stripped-dynamic-imports/a.js"),
],

plugins : [
plugin({
namer,
map,
}),
],
});

await bundle.write({
format,
sourcemap,

assetFileNames,
chunkFileNames,

dir : prefix(`./output/stripped-dynamic-imports`),
});

expect(dir("./stripped-dynamic-imports/assets/")).toMatchSnapshot();
});

it("should ouput only 1 JSON file", async () => {
const bundle = await rollup({
input : [
Expand Down Expand Up @@ -260,7 +287,7 @@ describe("/rollup.js", () => {

expect(dir("./multiple-chunks/assets")).toMatchSnapshot();
});

it("should dedupe chunk names using rollup's incrementing counter logic (hashed)", async () => {
const bundle = await rollup({
input : [
Expand Down

0 comments on commit 9363416

Please sign in to comment.