-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.rollup.js
49 lines (48 loc) · 1.18 KB
/
vite.config.rollup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
export const chunks = {
"vnd.react": ["react", "react-dom"],
"vnd.ui": [
"@mantine/core",
"@mantine/hooks",
"@mantine/notifications",
"@tabler/icons-react",
],
"vnd.lodash": [
"lodash",
"lodash/memoize",
"lodash/debounce",
"lodash/throttle",
"lodash/fp",
],
"vnd.chronoNode": ["chrono-node"],
"vnd.emojis": ["node-emoji"],
"vnd.marked": ["marked"],
"vnd.htmlMarkdown": ["node-html-markdown"],
"vnd.zustand": ["zustand"],
"vnd.json5": ["json5"],
"vnd.jszip": ["jszip"],
};
/** @type {import('vite').UserConfig.build.rollupOptions} */
export default {
treeshake: "smallest",
output: {
generatedCode: {
arrowFunctions: true,
constBindings: true,
objectShorthand: true,
hoistTransitiveImports: false,
},
manualChunks:
process.env.NODE_ENV === "production"
? (id) => {
const found = Object.entries(chunks).find(([_, value]) =>
value.some((m) => id.includes(m))
);
if (found) {
const [key] = found;
return key;
}
if (id.includes("gpt3")) return "vnd.gpt3.encoder";
}
: {},
},
};