Skip to content

Commit 2151332

Browse files
authored
feat: disable preserveAllComments by default (#3510)
1 parent c21e213 commit 2151332

File tree

12 files changed

+0
-83
lines changed

12 files changed

+0
-83
lines changed

packages/compat/plugin-webpack-swc/src/plugin.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ export function getDefaultSwcConfig(): TransformConfig {
166166
runtime: 'automatic',
167167
},
168168
},
169-
// Avoid the webpack magic comment to be removed
170-
// https://github.com/swc-project/swc/issues/6403
171-
preserveAllComments: true,
172169
},
173170
};
174171
}

packages/compat/plugin-webpack-swc/tests/__snapshots__/plugin.test.ts.snap

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
4141
"syntax": "typescript",
4242
"tsx": true,
4343
},
44-
"preserveAllComments": true,
4544
"transform": {
4645
"decoratorVersion": "2022-03",
4746
"legacyDecorator": false,
@@ -99,7 +98,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
9998
"syntax": "typescript",
10099
"tsx": true,
101100
},
102-
"preserveAllComments": true,
103101
"transform": {
104102
"decoratorVersion": "2022-03",
105103
"legacyDecorator": false,
@@ -155,7 +153,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
155153
"syntax": "typescript",
156154
"tsx": true,
157155
},
158-
"preserveAllComments": true,
159156
"transform": {
160157
"decoratorMetadata": true,
161158
"legacyDecorator": true,
@@ -211,7 +208,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
211208
"syntax": "typescript",
212209
"tsx": true,
213210
},
214-
"preserveAllComments": true,
215211
"transform": {
216212
"decoratorMetadata": true,
217213
"legacyDecorator": true,
@@ -275,7 +271,6 @@ exports[`plugin-webpack-swc > should apply source.include and source.exclude cor
275271
"syntax": "typescript",
276272
"tsx": true,
277273
},
278-
"preserveAllComments": true,
279274
"transform": {
280275
"decoratorVersion": "2022-03",
281276
"legacyDecorator": false,
@@ -333,7 +328,6 @@ exports[`plugin-webpack-swc > should apply source.include and source.exclude cor
333328
"syntax": "typescript",
334329
"tsx": true,
335330
},
336-
"preserveAllComments": true,
337331
"transform": {
338332
"decoratorVersion": "2022-03",
339333
"legacyDecorator": false,
@@ -394,7 +388,6 @@ exports[`plugin-webpack-swc > should disable react refresh when dev.hmr is false
394388
"syntax": "typescript",
395389
"tsx": true,
396390
},
397-
"preserveAllComments": true,
398391
"transform": {
399392
"decoratorVersion": "2022-03",
400393
"legacyDecorator": false,
@@ -452,7 +445,6 @@ exports[`plugin-webpack-swc > should disable react refresh when dev.hmr is false
452445
"syntax": "typescript",
453446
"tsx": true,
454447
},
455-
"preserveAllComments": true,
456448
"transform": {
457449
"decoratorVersion": "2022-03",
458450
"legacyDecorator": false,
@@ -506,7 +498,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
506498
"syntax": "typescript",
507499
"tsx": true,
508500
},
509-
"preserveAllComments": true,
510501
"transform": {
511502
"decoratorVersion": "2022-03",
512503
"legacyDecorator": false,
@@ -561,7 +552,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
561552
"syntax": "typescript",
562553
"tsx": true,
563554
},
564-
"preserveAllComments": true,
565555
"transform": {
566556
"decoratorVersion": "2022-03",
567557
"legacyDecorator": false,
@@ -618,7 +608,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
618608
"syntax": "typescript",
619609
"tsx": true,
620610
},
621-
"preserveAllComments": true,
622611
"transform": {
623612
"decoratorVersion": "2022-03",
624613
"legacyDecorator": false,
@@ -676,7 +665,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
676665
"syntax": "typescript",
677666
"tsx": true,
678667
},
679-
"preserveAllComments": true,
680668
"transform": {
681669
"decoratorVersion": "2022-03",
682670
"legacyDecorator": false,
@@ -733,7 +721,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
733721
"syntax": "typescript",
734722
"tsx": true,
735723
},
736-
"preserveAllComments": true,
737724
"transform": {
738725
"decoratorVersion": "2022-03",
739726
"legacyDecorator": false,
@@ -791,7 +778,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
791778
"syntax": "typescript",
792779
"tsx": true,
793780
},
794-
"preserveAllComments": true,
795781
"transform": {
796782
"decoratorVersion": "2022-03",
797783
"legacyDecorator": false,
@@ -901,7 +887,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
901887
"syntax": "typescript",
902888
"tsx": true,
903889
},
904-
"preserveAllComments": true,
905890
"transform": {
906891
"decoratorVersion": "2022-03",
907892
"legacyDecorator": false,
@@ -952,7 +937,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
952937
"syntax": "typescript",
953938
"tsx": true,
954939
},
955-
"preserveAllComments": true,
956940
"transform": {
957941
"decoratorVersion": "2022-03",
958942
"legacyDecorator": false,
@@ -1011,7 +995,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
1011995
"syntax": "typescript",
1012996
"tsx": true,
1013997
},
1014-
"preserveAllComments": true,
1015998
"transform": {
1016999
"decoratorVersion": "2022-03",
10171000
"legacyDecorator": false,
@@ -1095,7 +1078,6 @@ exports[`plugin-webpack-swc > should set swc-loader 1`] = `
10951078
"syntax": "typescript",
10961079
"tsx": true,
10971080
},
1098-
"preserveAllComments": true,
10991081
"transform": {
11001082
"decoratorVersion": "2022-03",
11011083
"legacyDecorator": false,
@@ -1153,7 +1135,6 @@ exports[`plugin-webpack-swc > should set swc-loader 1`] = `
11531135
"syntax": "typescript",
11541136
"tsx": true,
11551137
},
1156-
"preserveAllComments": true,
11571138
"transform": {
11581139
"decoratorVersion": "2022-03",
11591140
"legacyDecorator": false,
@@ -1216,7 +1197,6 @@ exports[`plugin-webpack-swc > should use output config 1`] = `
12161197
"syntax": "typescript",
12171198
"tsx": true,
12181199
},
1219-
"preserveAllComments": true,
12201200
"transform": {
12211201
"decoratorVersion": "2022-03",
12221202
"legacyDecorator": false,
@@ -1274,7 +1254,6 @@ exports[`plugin-webpack-swc > should use output config 1`] = `
12741254
"syntax": "typescript",
12751255
"tsx": true,
12761256
},
1277-
"preserveAllComments": true,
12781257
"transform": {
12791258
"decoratorVersion": "2022-03",
12801259
"legacyDecorator": false,

packages/core/src/plugins/swc.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ function getDefaultSwcConfig(
7575
syntax: 'typescript',
7676
decorators: true,
7777
},
78-
// Avoid the webpack magic comment to be removed
79-
// https://github.com/swc-project/swc/issues/6403
80-
preserveAllComments: true,
8178
experimental: {
8279
cacheRoot,
8380
},

packages/core/tests/__snapshots__/builder.test.ts.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
106106
"syntax": "typescript",
107107
"tsx": false,
108108
},
109-
"preserveAllComments": true,
110109
"transform": {
111110
"decoratorVersion": "2022-03",
112111
"legacyDecorator": false,
@@ -150,7 +149,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
150149
"syntax": "typescript",
151150
"tsx": false,
152151
},
153-
"preserveAllComments": true,
154152
"transform": {
155153
"decoratorVersion": "2022-03",
156154
"legacyDecorator": false,

packages/core/tests/__snapshots__/default.test.ts.snap

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
106106
"syntax": "typescript",
107107
"tsx": false,
108108
},
109-
"preserveAllComments": true,
110109
"transform": {
111110
"decoratorVersion": "2022-03",
112111
"legacyDecorator": false,
@@ -150,7 +149,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
150149
"syntax": "typescript",
151150
"tsx": false,
152151
},
153-
"preserveAllComments": true,
154152
"transform": {
155153
"decoratorVersion": "2022-03",
156154
"legacyDecorator": false,
@@ -501,7 +499,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
501499
"syntax": "typescript",
502500
"tsx": false,
503501
},
504-
"preserveAllComments": true,
505502
"transform": {
506503
"decoratorVersion": "2022-03",
507504
"legacyDecorator": false,
@@ -545,7 +542,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
545542
"syntax": "typescript",
546543
"tsx": false,
547544
},
548-
"preserveAllComments": true,
549545
"transform": {
550546
"decoratorVersion": "2022-03",
551547
"legacyDecorator": false,
@@ -944,7 +940,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
944940
"syntax": "typescript",
945941
"tsx": false,
946942
},
947-
"preserveAllComments": true,
948943
"transform": {
949944
"decoratorVersion": "2022-03",
950945
"legacyDecorator": false,
@@ -984,7 +979,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
984979
"syntax": "typescript",
985980
"tsx": false,
986981
},
987-
"preserveAllComments": true,
988982
"transform": {
989983
"decoratorVersion": "2022-03",
990984
"legacyDecorator": false,
@@ -1293,7 +1287,6 @@ exports[`tools.rspack > should match snapshot 1`] = `
12931287
"syntax": "typescript",
12941288
"tsx": false,
12951289
},
1296-
"preserveAllComments": true,
12971290
"transform": {
12981291
"decoratorVersion": "2022-03",
12991292
"legacyDecorator": false,
@@ -1337,7 +1330,6 @@ exports[`tools.rspack > should match snapshot 1`] = `
13371330
"syntax": "typescript",
13381331
"tsx": false,
13391332
},
1340-
"preserveAllComments": true,
13411333
"transform": {
13421334
"decoratorVersion": "2022-03",
13431335
"legacyDecorator": false,

packages/core/tests/__snapshots__/environments.test.ts.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
14781478
"syntax": "typescript",
14791479
"tsx": false,
14801480
},
1481-
"preserveAllComments": true,
14821481
"transform": {
14831482
"decoratorVersion": "2022-03",
14841483
"legacyDecorator": false,
@@ -1522,7 +1521,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
15221521
"syntax": "typescript",
15231522
"tsx": false,
15241523
},
1525-
"preserveAllComments": true,
15261524
"transform": {
15271525
"decoratorVersion": "2022-03",
15281526
"legacyDecorator": false,
@@ -1806,7 +1804,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
18061804
"syntax": "typescript",
18071805
"tsx": false,
18081806
},
1809-
"preserveAllComments": true,
18101807
"transform": {
18111808
"decoratorVersion": "2022-03",
18121809
"legacyDecorator": false,
@@ -1846,7 +1843,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
18461843
"syntax": "typescript",
18471844
"tsx": false,
18481845
},
1849-
"preserveAllComments": true,
18501846
"transform": {
18511847
"decoratorVersion": "2022-03",
18521848
"legacyDecorator": false,

0 commit comments

Comments
 (0)