混淆
使用 javascript-obfuscator 做标识符重命名、字符串数组编码和常量拆分。 在 vite build 后增加生产环境混淆步骤,开发环境保持源码可读。 关闭 sourcemap,避免直接暴露原始源码。 当前主包约 1.7 MB,建议先拆出第三方依赖,再只混淆应用自身代码,而不是整个 dist。
This commit is contained in:
1 parent
5f7e30063b
commit
c93ec671da
10 files changed
+2825
-1332
No files matched your search
@@ -44,6 +44,16 @@ function presetManifestPlugin(): Plugin {
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(), presetManifestPlugin()],
|
||||
build: {
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('/node_modules/') || id.includes('/vendor/spine/')) return 'vendor'
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 5173,
|
||||
host: true,
|
||||
|
||||
Reference in new issue
Block a user