JavaScript/vite/组件构建:修订间差异
来自康健生活
| 第10行: | 第10行: | ||
"sideEffects": false, | "sideEffects": false, | ||
} | } | ||
</syntaxhighlight>}} | |||
此外可以设置 vite 配置文件 preserveModules 以便更好地支持 tree shaking。 | |||
{{hc|head=vite.conf.ts|output=<syntaxhighlight lang="bash"> | |||
export default defineConfig({ | |||
build: { | |||
output: { | |||
preserveModules: true, | |||
// ... | |||
}) | |||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||