首页 > 其他分享 >使用vite创建vue3 遇到 process is not defined

使用vite创建vue3 遇到 process is not defined

时间:2023-01-24 14:11:08浏览次数:50  
标签:resolve process defined vue vue3 import vite

今天新建项目遇到报错,查资料得出,需要在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

相关文章