今天新建项目遇到报错,查资料得出,需要在vite.config.js中添加代码如下
import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import { resolve } from 'path' // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue()], resolve: { alias: { '@': resolve('src') } }, //解决process is not defined报错 define: { 'process.env': {} } })
标签:resolve,process,defined,vue,vue3,import,vite From: https://www.cnblogs.com/youyuan1980/p/17066048.html