修改路由打包配置
This commit is contained in:
parent
4bd9a3e156
commit
ac6d84d999
@ -80,7 +80,7 @@ export const constantRoutes = [
|
||||
}];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHistory(import.meta.env.VITE_APP_ROUTER_PREFIX),
|
||||
routes: constantRoutes,
|
||||
// scrollBehavior(to, from, savedPosition) {
|
||||
// if (savedPosition) {
|
||||
|
||||
@ -3,10 +3,7 @@ import path from 'path'
|
||||
import createVitePlugins from './vite/plugins'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({
|
||||
mode,
|
||||
command
|
||||
}) => {
|
||||
export default defineConfig(({ mode, command }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
return {
|
||||
plugins: createVitePlugins(env, command === 'build'),
|
||||
@ -21,6 +18,7 @@ export default defineConfig(({
|
||||
// https://cn.vitejs.dev/config/#resolve-extensions
|
||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
||||
},
|
||||
base: env.VITE_APP_ROUTER_PREFIX,
|
||||
// 打包配置
|
||||
build: {
|
||||
sourcemap: command === 'build' ? false : true,
|
||||
@ -28,7 +26,6 @@ export default defineConfig(({
|
||||
outDir: 'dist', //指定输出目录
|
||||
assetsDir: 'assets', //指定静态资源存储目录
|
||||
minify: 'terser', //混淆器,terser构建后文件体积更小
|
||||
publicDir: import.meta.env.VITE_APP_ROUTER_PREFIX
|
||||
},
|
||||
// vite 相关配置
|
||||
server: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user