A项目(vue-cli搭建)
router下index配置
import { createRouter, createWebHashHistory } from 'vue-router'
const router = createRouter({
history: createWebHashHistory('/app'),
routes: []
})
vue.config.js配置
module.exports = defineConfig({
devServer: {},
publicPath: '/app', //不加打包后白屏
})
B项目(vite搭建)
router下index配置
import { createRouter, createWebHashHistory } from 'vue-router'
const router = createRouter({
history: createWebHashHistory('/web'),
routes: []
})
vite.config.js配置
module.exports = defineConfig({
devServer: {},
base: '/web', //不加打包后白屏
})