首页 > 其他分享 >Vue 解决打包后启动后一片白的问题

Vue 解决打包后启动后一片白的问题

时间:2022-11-25 15:23:08浏览次数:40  
标签:Vue const 启动 publicPath 打包 路由 defineConfig

1.修改Vue.config.js文件

  加上:publicPath: './'

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: './'
})

 

2.如果有用到路由的话,则还需修改路由的index.ts文件

  修改路由模式:createWebHashHistory

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes
})

再次打包即可!!!

标签:Vue,const,启动,publicPath,打包,路由,defineConfig
From: https://www.cnblogs.com/zsbb/p/16925261.html

相关文章