- 修改 .gitignore 文件,更新 lock 文件忽略规则 - 在 package.json 中添加新的脚本命令 - 更新 vite.config.ts,增加代码混淆和优化配置
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
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: {
|
|
host: '0.0.0.0',
|
|
proxy: {
|
|
'/api': 'http://localhost:7546',
|
|
},
|
|
},
|
|
|
|
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)),
|
|
'@res': fileURLToPath(new URL('./src/resource', import.meta.url)),
|
|
'@com': fileURLToPath(new URL('./src/component', import.meta.url)),
|
|
},
|
|
},
|
|
});
|