chore: bring treeshake back (#11577)

This commit is contained in:
liuyi
2025-04-10 14:12:36 +08:00
committed by GitHub
parent 0ce5a9544b
commit e376aa57c5
8 changed files with 63 additions and 81 deletions

View File

@@ -67,7 +67,7 @@ export function createHTMLTargetConfig(
//#region basic webpack config
name: entry['index'],
dependencies: deps,
context: pkg.path.value,
context: ProjectRoot.value,
experiments: {
topLevelAwait: true,
outputModule: false,
@@ -335,7 +335,6 @@ export function createHTMLTargetConfig(
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
exclude: [/plugins\/.+\/.+\.js$/, /plugins\/.+\/.+\.mjs$/],
parallel: true,
extractComments: true,
terserOptions: {
@@ -498,35 +497,6 @@ export function createWorkerTargetConfig(
inlineSourcesContent: true,
},
},
{
test: /\.tsx$/,
exclude: /node_modules/,
loader: 'swc-loader',
options: {
// https://swc.rs/docs/configuring-swc/
jsc: {
preserveAllComments: true,
parser: {
syntax: 'typescript',
dynamicImport: true,
topLevelAwait: false,
tsx: true,
decorators: true,
},
target: 'es2022',
externalHelpers: false,
transform: {
react: {
runtime: 'automatic',
},
useDefineForClassFields: false,
decoratorVersion: '2022-03',
},
},
sourceMaps: true,
inlineSourcesContent: true,
},
},
],
},
],
@@ -561,7 +531,6 @@ export function createWorkerTargetConfig(
minimizer: [
new TerserPlugin({
minify: TerserPlugin.swcMinify,
exclude: [/plugins\/.+\/.+\.js$/, /plugins\/.+\/.+\.mjs$/],
parallel: true,
extractComments: true,
terserOptions: {
@@ -583,5 +552,8 @@ export function createWorkerTargetConfig(
runtimeChunk: false,
splitChunks: false,
},
performance: {
hints: false,
},
};
}