控制台报错:Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.文章来源:https://www.toymoban.com/news/detail-702228.html
打包路径问题,修改vite.config.ts文件的base文章来源地址https://www.toymoban.com/news/detail-702228.html
export default defineConfig({
plugins: [vue()],
base: '/', // 改为 根目录 /
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
less: {
additionalData: `@import "@/assets/css/index.less";`
}
}
}
})
到了这里,关于vue3 vite 打包 二级目录刷新空白的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!