Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/development/acceptance/ReactRefreshLogBox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ describe('ReactRefreshLogBox', () => {
| ^",
"stack": [
"[project]/index.js [ssr] (ecmascript) index.js (3:7)",
"<FIXME-next-dist-dir>",
"<FIXME-next-dist-dir>",
"[project]/pages/index.js [ssr] (ecmascript) <module evaluation> pages/index.js (1:1)",
"[project]/pages/index.js [ssr] (ecmascript) pages/index.js (1:1)",
"<FIXME-next-dist-dir>",
],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ impl AnalyzeEcmascriptModuleResultBuilder {
/// If you're unsure about which function to use, use `add_reference()`
pub fn add_esm_evaluation_reference(&mut self, idx: usize) {
self.esm_references.insert(idx);
self.esm_local_references.insert(idx);
self.esm_evaluation_references.insert(idx);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
import {
a as a0,
b as b0,
c as c0,
d as d0,
e as e0,
def as def0,
} from "package-named";
it("should optimize named reexports from side effect free module", () => {
expect(a0).toBe("a");
expect(b0).toBe("b");
expect(c0).toBe("x");
expect(d0).toBe("y");
expect(e0).toBe("x");
expect(def0).toBe("default");
});

import {
a as a1,
b as b1,
Expand All @@ -7,8 +24,8 @@ import {
local as local1,
default as default1,
def as def1,
} from "package-named";
it("should optimize named reexports from side effect free module", () => {
} from "package-named-local";
it("should optimize named reexports with locals from side effect free module", () => {
expect(a1).toBe("a");
expect(b1).toBe("b");
expect(c1).toBe("x");
Expand All @@ -19,11 +36,10 @@ it("should optimize named reexports from side effect free module", () => {
expect(def1).toBe("default");
});

import { a as a2, b as b2, local as local2 } from "package-star";
import { a as a2, b as b2 } from "package-star";
it("should optimize star reexports from side effect free module", () => {
expect(a2).toBe("a");
expect(b2).toBe("b");
expect(local2).toBe("local");
});

import {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import getValue from "./reexport.js";

it("should not optimize away side effects", () => {
expect(getValue()).toBe(42);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sideEffects": [
"./index.js",
"./valueSetter.js"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { value } from "./valueSetter.js";

export { value } from "./valueSetter.js";

export default () => {
return value
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export let value = undefined;
export function setValue(newValue) {
value = newValue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { setValue } from "./valueContainer.js";
setValue(42);
export * from "./valueContainer.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"treeShakingMode": "reexports-only"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "../../../side-effects-optimization/follow-keeps-side-effect/input/index.js";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"treeShakingMode": "module-fragments"
}
Loading