chore: use swc instead of esbuild (#359)

使用 swc 代替 esbuild,之前在 https://github.com/halo-dev/docs/pull/358 中引入了 esbuild,但发现在生产构建之后会出现这个问题:

<img width="1912" alt="image" src="https://github.com/halo-dev/docs/assets/21301288/5dcd724d-3876-4e58-b902-1818dd9d1fbd">

暂时不清楚为什么,使用 swc 测试构建之后没有这个问题。

/kind bug

```release-note
None
```
wan92hen-patch-1
Ryan Wang 6 months ago committed by GitHub
parent ac0b158b73
commit d78a16e217
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -256,11 +256,18 @@ const config = {
], ],
webpack: { webpack: {
jsLoader: (isServer) => ({ jsLoader: (isServer) => ({
loader: require.resolve('esbuild-loader'), loader: require.resolve("swc-loader"),
options: { options: {
loader: 'tsx', jsc: {
format: isServer ? 'cjs' : undefined, parser: {
target: isServer ? 'node12' : 'es2017', syntax: "typescript",
tsx: true,
},
target: "es2017",
},
module: {
type: isServer ? "commonjs" : "es6",
},
}, },
}), }),
}, },

@ -47,9 +47,10 @@
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "^2.4.1", "@docusaurus/module-type-aliases": "^2.4.1",
"esbuild-loader": "^4.1.0", "@swc/core": "^1.5.7",
"husky": "^7.0.4", "husky": "^7.0.4",
"markdownlint": "^0.25.1", "markdownlint": "^0.25.1",
"markdownlint-cli2": "^0.4.0" "markdownlint-cli2": "^0.4.0",
"swc-loader": "^0.2.6"
} }
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save