Closed ygj6 closed 1 year ago
在 vite.config.ts
中添加以下代码:
define: {
'process.env': { ...process.env }
}
例如:
// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
define: {
'process.env': { ...process.env }
}
})
参考:https://opentiny.design/tiny-vue/zh-CN/os-theme/docs/installation
Version
3.6.8
Vue Version
3.6.8
Link to minimal reproduction
正常创建vue工程,以插件方式使用 tiny-vue,如下:
Step to reproduce
在vite环境下,执行npm dev
What is expected
启动工程正常
What is actually happening
启动工程报错
Any additional comments (optional)
全局引入 '@opentiny/vue' 时,无法确定
process.env
的值 export const version = process.env.COMPONENT_VERSION