Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: disable preserveAllComments by default #3510

Merged
merged 1 commit into from
Sep 18, 2024
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
3 changes: 0 additions & 3 deletions packages/compat/plugin-webpack-swc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ export function getDefaultSwcConfig(): TransformConfig {
runtime: 'automatic',
},
},
// Avoid the webpack magic comment to be removed
// https://github.com/swc-project/swc/issues/6403
preserveAllComments: true,
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -99,7 +98,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -155,7 +153,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
Expand Down Expand Up @@ -211,7 +208,6 @@ exports[`plugin-webpack-swc > should apply multiple environment configs correctl
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorMetadata": true,
"legacyDecorator": true,
Expand Down Expand Up @@ -275,7 +271,6 @@ exports[`plugin-webpack-swc > should apply source.include and source.exclude cor
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -333,7 +328,6 @@ exports[`plugin-webpack-swc > should apply source.include and source.exclude cor
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -394,7 +388,6 @@ exports[`plugin-webpack-swc > should disable react refresh when dev.hmr is false
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -452,7 +445,6 @@ exports[`plugin-webpack-swc > should disable react refresh when dev.hmr is false
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -506,7 +498,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -561,7 +552,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -618,7 +608,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -676,7 +665,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -733,7 +721,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -791,7 +778,6 @@ exports[`plugin-webpack-swc > should disable react refresh when target is not we
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -901,7 +887,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -952,7 +937,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1011,7 +995,6 @@ exports[`plugin-webpack-swc > should set multiple swc-loader 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1095,7 +1078,6 @@ exports[`plugin-webpack-swc > should set swc-loader 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1153,7 +1135,6 @@ exports[`plugin-webpack-swc > should set swc-loader 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1216,7 +1197,6 @@ exports[`plugin-webpack-swc > should use output config 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1274,7 +1254,6 @@ exports[`plugin-webpack-swc > should use output config 1`] = `
"syntax": "typescript",
"tsx": true,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/plugins/swc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ function getDefaultSwcConfig(
syntax: 'typescript',
decorators: true,
},
// Avoid the webpack magic comment to be removed
// https://github.com/swc-project/swc/issues/6403
preserveAllComments: true,
experimental: {
cacheRoot,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/core/tests/__snapshots__/builder.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -150,7 +149,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down
8 changes: 0 additions & 8 deletions packages/core/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -150,7 +149,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -501,7 +499,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -545,7 +542,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -944,7 +940,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -984,7 +979,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1293,7 +1287,6 @@ exports[`tools.rspack > should match snapshot 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1337,7 +1330,6 @@ exports[`tools.rspack > should match snapshot 1`] = `
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/tests/__snapshots__/environments.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1522,7 +1521,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1806,7 +1804,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down Expand Up @@ -1846,7 +1843,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
"syntax": "typescript",
"tsx": false,
},
"preserveAllComments": true,
"transform": {
"decoratorVersion": "2022-03",
"legacyDecorator": false,
Expand Down
Loading
Loading