Skip to content

Commit de9e525

Browse files
authored
feat: source order for harmony import dependency (#4262)
* impl * test * lint * lockfile
1 parent d9952e8 commit de9e525

File tree

62 files changed

+576
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+576
-384
lines changed

crates/rspack/tests/fixtures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn samples(fixture_path: PathBuf) {
2525
fn tree_shaking(fixture_path: PathBuf) {
2626
// For each test case
2727
// First test is old version tree shaking snapshot test
28-
// test_fixture(&fixture_path, Box::new(|_, _| {}), None);
28+
test_fixture(&fixture_path, Box::new(|_, _| {}), None);
2929
// second test is webpack based tree shaking
3030
IS_NEW_TREESHAKING.store(true, Ordering::SeqCst);
3131
test_fixture(

crates/rspack/tests/tree-shaking/bb/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ source: crates/rspack_testing/src/run_fixture.rs
66
"./a.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
77
'use strict';
88
__webpack_require__.r(__webpack_exports__);
9+
/* harmony import */var _b_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./b.js */"./b.js");
910
/* harmony import */var _c_js__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./c.js */"./c.js");
1011
__webpack_require__.es(_c_js__WEBPACK_IMPORTED_MODULE_1_, __webpack_exports__);
11-
/* harmony import */var _b_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./b.js */"./b.js");
1212
1313
1414
const a = 3;

crates/rspack/tests/tree-shaking/bb/snapshot/snap.diff

Lines changed: 0 additions & 13 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/export-all-from-side-effects-free-commonjs/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ source: crates/rspack_testing/src/run_fixture.rs
55
(self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], {
66
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
77
'use strict';
8-
__webpack_require__.r(__webpack_exports__);
98
var _lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache;
9+
__webpack_require__.r(__webpack_exports__);
1010
/* harmony import */var _lib__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./lib */"./lib.js");
1111
1212
/*#__PURE__*/ (_lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache || (_lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache = __webpack_require__.t(_lib__WEBPACK_IMPORTED_MODULE_0_, 2)));

crates/rspack/tests/tree-shaking/export-all-from-side-effects-free-commonjs/snapshot/output.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ source: crates/rspack_testing/src/run_fixture.rs
55
(self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], {
66
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
77
'use strict';
8-
__webpack_require__.r(__webpack_exports__);
98
var _lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache;
9+
__webpack_require__.r(__webpack_exports__);
1010
/* harmony import */var _lib__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./lib */"./lib.js");
1111
1212
/*#__PURE__*/ (_lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache || (_lib__WEBPACK_IMPORTED_MODULE_0__namespace_cache = __webpack_require__.t(_lib__WEBPACK_IMPORTED_MODULE_0_, 2)));

crates/rspack/tests/tree-shaking/import-export-all-as-a-empty-module/snapshot/new_treeshaking.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ __webpack_require__.d(__webpack_exports__, {
1010
'aaa': function() { return _app__WEBPACK_IMPORTED_MODULE_1_; },
1111
'routes': function() { return routes; }
1212
});
13-
/* harmony import */var _app__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./app */"./app.js");
14-
/* harmony import */var _app__WEBPACK_IMPORTED_MODULE_1__default = /*#__PURE__*/__webpack_require__.n(_app__WEBPACK_IMPORTED_MODULE_1_);
1513
/* harmony import */var _answer__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./answer */"./answer.js");
1614
/* harmony import */var _answer__WEBPACK_IMPORTED_MODULE_0__default = /*#__PURE__*/__webpack_require__.n(_answer__WEBPACK_IMPORTED_MODULE_0_);
15+
/* harmony import */var _app__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./app */"./app.js");
16+
/* harmony import */var _app__WEBPACK_IMPORTED_MODULE_1__default = /*#__PURE__*/__webpack_require__.n(_app__WEBPACK_IMPORTED_MODULE_1_);
1717
1818
1919
const routes = {

crates/rspack/tests/tree-shaking/import-export-all-as-a-empty-module/snapshot/snap.diff

Lines changed: 0 additions & 15 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/import-var-assign-side-effects/snapshot/new_treeshaking.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ __webpack_require__.r(__webpack_exports__);
3838
__webpack_require__.r(__webpack_exports__);
3939
/* harmony import */var _Layout_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./Layout.js */"./Layout.js");
4040
/* harmony import */var _Something_js__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./Something.js */"./Something.js");
41-
/* harmony import */var _Layout_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./Layout.js */"./Layout.js");
4241
4342
4443
_Layout_js__WEBPACK_IMPORTED_MODULE_0_["default"].sider = _Something_js__WEBPACK_IMPORTED_MODULE_1_["default"];

crates/rspack/tests/tree-shaking/import-var-assign-side-effects/snapshot/snap.diff

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/* harmony import */var _Something__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./Something */"./Something.js");
2727

2828

29-
@@ -30,6 +33,17 @@
29+
@@ -30,6 +33,16 @@
3030

3131
(0, _export__WEBPACK_IMPORTED_MODULE_0_.Sider)();
3232
},
@@ -35,7 +35,6 @@
3535
+__webpack_require__.r(__webpack_exports__);
3636
+/* harmony import */var _Layout_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./Layout.js */"./Layout.js");
3737
+/* harmony import */var _Something_js__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./Something.js */"./Something.js");
38-
+/* harmony import */var _Layout_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./Layout.js */"./Layout.js");
3938
+
4039
+
4140
+_Layout_js__WEBPACK_IMPORTED_MODULE_0_["default"].sider = _Something_js__WEBPACK_IMPORTED_MODULE_1_["default"];

crates/rspack/tests/tree-shaking/inherit_export_map_should_lookup_in_dfs_order/snapshot/new_treeshaking.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ __webpack_require__.d(__webpack_exports__, {
2626
/* harmony import */var _foo__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./foo */"./foo.js");
2727
__webpack_require__.es(_foo__WEBPACK_IMPORTED_MODULE_0_, __webpack_exports__);
2828
/* harmony import */var _bar__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./bar */"./bar.js");
29-
__webpack_require__.es(_bar__WEBPACK_IMPORTED_MODULE_1_, __webpack_exports__);
30-
/* harmony import */var _bar__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./bar */"./bar.js");
3129
__webpack_require__.es(_bar__WEBPACK_IMPORTED_MODULE_1_, __webpack_exports__);
3230
3331

crates/rspack/tests/tree-shaking/inherit_export_map_should_lookup_in_dfs_order/snapshot/snap.diff

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,7 @@
1818
const a = 'bar';
1919
const c = 'bar';
2020
},
21-
@@ -27,6 +27,8 @@
22-
__webpack_require__.es(_foo__WEBPACK_IMPORTED_MODULE_0_, __webpack_exports__);
23-
/* harmony import */var _bar__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./bar */"./bar.js");
24-
__webpack_require__.es(_bar__WEBPACK_IMPORTED_MODULE_1_, __webpack_exports__);
25-
+/* harmony import */var _bar__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./bar */"./bar.js");
26-
+__webpack_require__.es(_bar__WEBPACK_IMPORTED_MODULE_1_, __webpack_exports__);
27-
28-
29-
const a = 3;
30-
@@ -34,9 +36,6 @@
21+
@@ -34,9 +34,6 @@
3122
"./foo.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3223
'use strict';
3324
__webpack_require__.r(__webpack_exports__);

crates/rspack/tests/tree-shaking/module-rule-side-effects1/snapshot/new_treeshaking.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ __webpack_require__.r(__webpack_exports__);
2121
__webpack_require__.r(__webpack_exports__);
2222
/* harmony import */var _a_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./a.js */"./a.js");
2323
/* harmony import */var _c_js__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c.js */"./c.js");
24-
/* harmony import */var _a_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./a.js */"./a.js");
2524
2625
2726

crates/rspack/tests/tree-shaking/module-rule-side-effects1/snapshot/snap.diff

Lines changed: 0 additions & 10 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/module-rule-side-effects2/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ __webpack_require__.r(__webpack_exports__);
1919
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2020
'use strict';
2121
__webpack_require__.r(__webpack_exports__);
22-
/* harmony import */var _b_js__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./b.js */"./b.js");
2322
/* harmony import */var _a_js__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./a.js */"./a.js");
23+
/* harmony import */var _b_js__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./b.js */"./b.js");
2424
2525
2626

crates/rspack/tests/tree-shaking/module-rule-side-effects2/snapshot/snap.diff

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/named-export-decl-with-src-eval/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ __webpack_require__.r(__webpack_exports__);
3333
__webpack_require__.d(__webpack_exports__, {
3434
'cccc': function() { return _c__WEBPACK_IMPORTED_MODULE_2_.cccc; }
3535
});
36-
/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
3736
/* harmony import */var _Layout__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./Layout */"./Layout.js");
3837
/* harmony import */var _Something__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./Something */"./Something.js");
38+
/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
3939
4040
4141
var L = _Layout__WEBPACK_IMPORTED_MODULE_0_["default"];

crates/rspack/tests/tree-shaking/named-export-decl-with-src-eval/snapshot/snap.diff

Lines changed: 0 additions & 13 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/webpack-inner-graph-export-default-named/snapshot/new_treeshaking.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ new def().method();
112112
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
113113
'use strict';
114114
__webpack_require__.r(__webpack_exports__);
115-
/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
116-
/* harmony import */var _f__WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(/* ./f */"./f.js");
117115
/* harmony import */var _a__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./a */"./a.js");
116+
/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
118117
/* harmony import */var _d__WEBPACK_IMPORTED_MODULE_3_ = __webpack_require__(/* ./d */"./d.js");
118+
/* harmony import */var _f__WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(/* ./f */"./f.js");
119119
/* harmony import */var _dep_a__WEBPACK_IMPORTED_MODULE_6_ = __webpack_require__(/* ./dep?a */"./dep.js?a");
120120
/* harmony import */var _dep_b__WEBPACK_IMPORTED_MODULE_7_ = __webpack_require__(/* ./dep?b */"./dep.js?b");
121121
/* harmony import */var _dep_c__WEBPACK_IMPORTED_MODULE_8_ = __webpack_require__(/* ./dep?c */"./dep.js?c");

crates/rspack/tests/tree-shaking/webpack-inner-graph-export-default-named/snapshot/snap.diff

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@
4343
},
4444
"./dep.js?e": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
4545
'use strict';
46-
@@ -104,19 +95,8 @@
46+
@@ -104,18 +95,7 @@
4747
'default': function() { return __WEBPACK_DEFAULT_EXPORT__; }
4848
});
4949
const x = "x";
5050
-var __WEBPACK_DEFAULT_EXPORT__ = true;
51-
+var __WEBPACK_DEFAULT_EXPORT__ = false;
52-
},
51+
-},
5352
-"./e.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5453
-'use strict';
5554
-__webpack_require__.r(__webpack_exports__);
@@ -60,22 +59,18 @@
6059
- return /* "./dep?e" unused */null;
6160
- }
6261
-}
63-
-},
62+
+var __WEBPACK_DEFAULT_EXPORT__ = false;
63+
},
6464
"./f.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6565
'use strict';
66-
__webpack_require__.r(__webpack_exports__);
67-
@@ -132,12 +112,10 @@
68-
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
66+
@@ -133,10 +113,8 @@
6967
'use strict';
7068
__webpack_require__.r(__webpack_exports__);
71-
+/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
72-
+/* harmony import */var _f__WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(/* ./f */"./f.js");
7369
/* harmony import */var _a__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./a */"./a.js");
7470
-/* harmony import */var _b__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./b */"./b.js");
75-
-/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
71+
/* harmony import */var _c__WEBPACK_IMPORTED_MODULE_2_ = __webpack_require__(/* ./c */"./c.js");
7672
/* harmony import */var _d__WEBPACK_IMPORTED_MODULE_3_ = __webpack_require__(/* ./d */"./d.js");
7773
-/* harmony import */var _e__WEBPACK_IMPORTED_MODULE_4_ = __webpack_require__(/* ./e */"./e.js");
78-
-/* harmony import */var _f__WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(/* ./f */"./f.js");
74+
/* harmony import */var _f__WEBPACK_IMPORTED_MODULE_5_ = __webpack_require__(/* ./f */"./f.js");
7975
/* harmony import */var _dep_a__WEBPACK_IMPORTED_MODULE_6_ = __webpack_require__(/* ./dep?a */"./dep.js?a");
8076
/* harmony import */var _dep_b__WEBPACK_IMPORTED_MODULE_7_ = __webpack_require__(/* ./dep?b */"./dep.js?b");
81-
/* harmony import */var _dep_c__WEBPACK_IMPORTED_MODULE_8_ = __webpack_require__(/* ./dep?c */"./dep.js?c");

crates/rspack/tests/tree-shaking/webpack-innergraph-circular/snapshot/new_treeshaking.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ __webpack_require__.r(__webpack_exports__);
2020
__webpack_require__.r(__webpack_exports__);
2121
/* harmony import */var _inner__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./inner */"./inner.js");
2222
/* harmony import */var _module__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./module */"./module.js");
23-
/* harmony import */var _inner__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./inner */"./inner.js");
2423
2524
2625
it("export should be unused when only unused functions use it", ()=>{

crates/rspack/tests/tree-shaking/webpack-innergraph-circular/snapshot/snap.diff

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
--- expected
22
+++ actual
3-
@@ -20,6 +20,7 @@
4-
__webpack_require__.r(__webpack_exports__);
5-
/* harmony import */var _inner__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./inner */"./inner.js");
6-
/* harmony import */var _module__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* ./module */"./module.js");
7-
+/* harmony import */var _inner__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* ./inner */"./inner.js");
8-
9-
10-
it("export should be unused when only unused functions use it", ()=>{
11-
@@ -36,6 +37,7 @@
3+
@@ -36,6 +36,7 @@
124
__webpack_require__.d(__webpack_exports__, {
135
'A': function() { return A; },
146
'B': function() { return B; },
157
+ 'C': function() { return C; },
168
'exportAUsed': function() { return exportAUsed; },
179
'exportBUsed': function() { return exportBUsed; },
1810
'exportCUsed': function() { return exportCUsed; }
19-
@@ -49,8 +51,8 @@
11+
@@ -49,8 +50,8 @@
2012
function C(s) {
2113
return s + "C";
2214
}
@@ -27,7 +19,7 @@
2719
const exportCUsed = false;
2820
},
2921
"./module.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
30-
@@ -84,7 +86,7 @@
22+
@@ -84,7 +85,7 @@
3123
}
3224
function withC(v) {
3325
const value = x(v);

crates/rspack/tests/tree-shaking/webpack-side-effects-all-used/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ __webpack_require__.d(__webpack_exports__, {
8282
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8383
'use strict';
8484
__webpack_require__.r(__webpack_exports__);
85-
/* harmony import */var pmodule__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* pmodule */"../node_modules/pmodule/index.js");
8685
/* harmony import */var pmodule_tracker__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* pmodule/tracker */"../node_modules/pmodule/tracker.js");
86+
/* harmony import */var pmodule__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* pmodule */"../node_modules/pmodule/index.js");
8787
8888
8989

crates/rspack/tests/tree-shaking/webpack-side-effects-all-used/snapshot/snap.diff

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/webpack-side-effects-simple-unused/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ __webpack_require__.d(__webpack_exports__, {
6666
"./index.js": function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
6767
'use strict';
6868
__webpack_require__.r(__webpack_exports__);
69-
/* harmony import */var pmodule__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* pmodule */"../node_modules/pmodule/index.js");
7069
/* harmony import */var pmodule_tracker__WEBPACK_IMPORTED_MODULE_0_ = __webpack_require__(/* pmodule/tracker */"../node_modules/pmodule/tracker.js");
70+
/* harmony import */var pmodule__WEBPACK_IMPORTED_MODULE_1_ = __webpack_require__(/* pmodule */"../node_modules/pmodule/index.js");
7171
7272
7373

crates/rspack/tests/tree-shaking/webpack-side-effects-simple-unused/snapshot/snap.diff

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/rspack/tests/tree-shaking/with-assets/snapshot/new_treeshaking.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _a_js__WEBPACK_IMPORTED_MODULE_0_.a;
2222
_a_svg__WEBPACK_IMPORTED_MODULE_1_;
2323
},
2424
"./a.svg": function (module, exports, __webpack_require__) {
25+
'use strict';
2526
module.exports = "data:image/svg+xml;base64,";},
2627
2728
},function(__webpack_require__) {

crates/rspack/tests/tree-shaking/with-assets/snapshot/output.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ _a_js__WEBPACK_IMPORTED_MODULE_0_.a;
2222
_a_svg__WEBPACK_IMPORTED_MODULE_1_;
2323
},
2424
"./a.svg": function (module, exports, __webpack_require__) {
25+
'use strict';
2526
module.exports = "data:image/svg+xml;base64,";},
2627
2728
},function(__webpack_require__) {

crates/rspack_core/src/code_generation_results.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,12 @@ impl CodeGenerationResult {
128128
source_type.hash(&mut hasher);
129129
source.hash(&mut hasher);
130130
}
131-
for (k, v) in &self.chunk_init_fragments {
132-
k.hash(&mut hasher);
133-
v.hash(&mut hasher);
134-
}
131+
self.chunk_init_fragments.hash(&mut hasher);
135132
self.hash = Some(hasher.digest(hash_digest));
136133
}
137134
}
138135

139-
#[derive(Default, Debug)]
136+
#[derive(Debug, Default)]
140137
pub struct CodeGenerationResults {
141138
// TODO: This should be a map of ModuleIdentifier to CodeGenerationResult
142139
pub module_generation_result_map: IdentifierMap<CodeGenerationResult>,

0 commit comments

Comments
 (0)