控制台报错: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.
打包路径问题,修改vite.config.ts文件的base
export default defineConfig({
plugins: [vue()],
base: '/', // 改为 根目录 /
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
css: {
preprocessorOptions: {
less: {
additionalData: `@import "@/assets/css/index.less";`
}
}
}
})