vue2和vue3未使用vite打包
vue.config文件夹下
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
// 打包需要配置下 避免发布后报错
publicPath: process.env.NODE_ENV === 'production' ? './' : './',
transpileDependencies: true
})
使用vite打包配置
vite.config
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
// 打包配置
base: process.env.NODE_ENV === 'production' ? './' : '/',
server: {
port: 5173,
host: "0.0.0.0",
},
})