命令
npm run build
直接打包可能会访问报错
We’re sorry but qnjms doesn’t work properly without JavaScript enabled. Please enable it to continue.
需要进行配置
打开vue.config.js,加入publicPath配置
const {
defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath: process.env.NODE_ENV === 'production' ? './' : '/'
})
然后再打包就解决问题了。