-
-
Notifications
You must be signed in to change notification settings - Fork 553
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: side effects plugin should not compute based on affected
- Loading branch information
Showing
8 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...t-tools/tests/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/foo.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const v = 'foo' |
16 changes: 16 additions & 0 deletions
16
...tools/tests/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {v as value} from "./module"; | ||
|
||
let v = value; | ||
module.hot.accept('./module', () => { | ||
v = value | ||
}); | ||
|
||
it("should auto-reexport an ES6 imported value on accept with newTreeshaking", async function (done) { | ||
expect(v).toBe("foo"); | ||
NEXT( | ||
require("../../update")(done, true, () => { | ||
expect(v).toBe("foo"); | ||
done(); | ||
}) | ||
); | ||
}); |
7 changes: 7 additions & 0 deletions
7
...ools/tests/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/module.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {v} from './reexports' | ||
v; | ||
export {v}; | ||
---- | ||
import {v} from './reexports' | ||
v;// no-op | ||
export {v}; |
3 changes: 3 additions & 0 deletions
3
...s/tests/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"sideEffects": false | ||
} |
2 changes: 2 additions & 0 deletions
2
...ts/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/reexports-deep.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import {v} from './foo'; | ||
export {v}; |
2 changes: 2 additions & 0 deletions
2
...s/tests/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/reexports.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import {v} from './reexports-deep'; | ||
export {v}; |
7 changes: 7 additions & 0 deletions
7
...sts/hotCases/newTreeshaking/re-export-optimization-for-inaffected-module/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
optimization: { | ||
sideEffects: true, | ||
providedExports: true, | ||
} | ||
}; |