mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-01 01:30:46 +08:00
Provide function for manualChunks
Instead of hardcoding the manualChunks this allows us to reduce chunk size of index, and make it more flexible for new dependencies.
This commit is contained in:
+10
-26
@@ -42,32 +42,16 @@ export default defineConfig({
|
||||
outDir: "build",
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
markdown: [
|
||||
"@radicle/gray-matter",
|
||||
"dompurify",
|
||||
"hast-util-to-dom",
|
||||
"hast-util-to-html",
|
||||
"katex",
|
||||
"marked",
|
||||
],
|
||||
syntax: ["@wooorm/starry-night"],
|
||||
grammarsTsx: [
|
||||
"@wooorm/starry-night/source.ts",
|
||||
"@wooorm/starry-night/source.tsx",
|
||||
],
|
||||
grammars: [
|
||||
"@wooorm/starry-night/source.python",
|
||||
"@wooorm/starry-night/source.js",
|
||||
"@wooorm/starry-night/source.perl",
|
||||
"@wooorm/starry-night/source.haskell",
|
||||
"@wooorm/starry-night/source.ruby",
|
||||
"@wooorm/starry-night/source.css",
|
||||
"@wooorm/starry-night/source.solidity",
|
||||
"@wooorm/starry-night/source.cs",
|
||||
"@wooorm/starry-night/source.swift",
|
||||
],
|
||||
dom: ["svelte", "twemoji"],
|
||||
manualChunks: id => {
|
||||
if (id.includes("lodash")) {
|
||||
return "lodash";
|
||||
} else if (id.includes("katex")) {
|
||||
return "katex";
|
||||
} else if (id.includes("node_modules")) {
|
||||
return "vendor";
|
||||
} else if (id.includes("components")) {
|
||||
return "components";
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user