update vite.config.js

This commit is contained in:
不做码农 2022-04-18 19:59:48 +08:00
parent 3712f01a36
commit 7db2a56a87

View File

@ -18,14 +18,15 @@ export default defineConfig(({ mode, command }) => {
// https://cn.vitejs.dev/config/#resolve-extensions // https://cn.vitejs.dev/config/#resolve-extensions
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'], extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
}, },
css: {
devSourcemap: true //开发模式时启用
},
base: env.VITE_APP_ROUTER_PREFIX, base: env.VITE_APP_ROUTER_PREFIX,
// 打包配置 // 打包配置
build: { build: {
sourcemap: command === 'build' ? false : true, sourcemap: command === 'build' ? false : true,
target: 'modules',
outDir: 'dist', //指定输出目录 outDir: 'dist', //指定输出目录
assetsDir: 'assets', //指定静态资源存储目录 assetsDir: 'assets', //指定静态资源存储目录(相对于outDir)
minify: 'terser', //混淆器terser构建后文件体积更小
}, },
// vite 相关配置 // vite 相关配置
server: { server: {