Merge pull request 'build(vite): 优化代码构建并添加混淆' (#2) from dev into master
Reviewed-on: #2
This commit is contained in:
commit
9b2170cab2
2
.gitignore
vendored
2
.gitignore
vendored
@ -29,4 +29,4 @@ coverage
|
||||
|
||||
*.tsbuildinfo
|
||||
|
||||
*.lock*
|
||||
*lock*
|
||||
|
@ -8,9 +8,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"d": "vite",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"preview": "vite preview",
|
||||
"build-only": "vite build",
|
||||
"b": "vite build",
|
||||
"type-check": "vue-tsc --build",
|
||||
"format": "prettier --write src/"
|
||||
},
|
||||
@ -29,6 +31,7 @@
|
||||
"pinia": "^3.0.3",
|
||||
"pinia-plugin-persistedstate": "^4.5.0",
|
||||
"sass-embedded": "^1.90.0",
|
||||
"vite-plugin-bundle-obfuscator": "^1.8.0",
|
||||
"vue": "^3.5.18",
|
||||
"vue-router": "^4.5.1"
|
||||
},
|
||||
|
@ -3,7 +3,9 @@ import { fileURLToPath, URL } from 'node:url';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import vueDevTools from 'vite-plugin-vue-devtools';
|
||||
import Obfuscator from 'vite-plugin-bundle-obfuscator';
|
||||
|
||||
const date = new Date().getTime();
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
server: {
|
||||
@ -12,7 +14,32 @@ export default defineConfig({
|
||||
'/api': 'http://localhost:7546',
|
||||
},
|
||||
},
|
||||
plugins: [vue(), vueDevTools()],
|
||||
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
chunkFileNames: `assets/data/js/[hash].${date}.js`,
|
||||
entryFileNames: `assets/data/js/[hash].${date}.js`,
|
||||
assetFileNames: `assets/data/[ext]/[hash].${date}.[ext]`,
|
||||
},
|
||||
},
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
vueDevTools(),
|
||||
Obfuscator({
|
||||
enable: true,
|
||||
log: true,
|
||||
autoExcludeNodeModules: true,
|
||||
threadPool: true,
|
||||
}),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user