Comments (14)
这样可以保证loadEnv在任何地方不会抛出process.cwd is not a function
from vue-pure-admin.
from vue-pure-admin.
from vue-pure-admin.
还有单独调用loadEnv方法,好像process.cwd()报错了
from vue-pure-admin.
from vue-pure-admin.
我是在router index.ts中单独调用,发现process.cwd报错,但是在vite.config.ts中调用process.cwd是没有问题的
难道无法再别的地方调用么~~
from vue-pure-admin.
比如你可以这样用:process.env.NODE_ENV
from vue-pure-admin.
from vue-pure-admin.
是的,这样是可以的,但是当引入某些第三包时,会出现打包错误
from vue-pure-admin.
3817 有类似案例,仓库地址: vite_vue3_web3
from vue-pure-admin.
from vue-pure-admin.
这样打包部署会找不到process 我已经删除了此代码 请检查对你有没有影响
from vue-pure-admin.
好的,在更改之后,我在本地build 部署之后是可以正常运行的,之前这么做是因为dotenv 读取环境变量用到了node相关内置函数,现在应该没有什么影响
from vue-pure-admin.
from vue-pure-admin.
Related Issues (20)
- 大佬,什么时候实现基于前端实现的权限 HOT 1
- 请升级vue版本 HOT 1
- withDefaults未达到预期
- main分支 点击外链 一次打开两个新窗口
- layout组件完全没有渲染
- 登录处理建议 HOT 1
- 间隔一段时间切换二级菜单的时候,经常出现页面渲染不出来,呈现空白的情况,控制台无报错信息和警告
- 标签页面无法销毁路由缓存
- 不算bug,一丢丢文档问题 HOT 1
- 表格adaptive属性在列表初始化隐藏的时候高度异常 HOT 3
- 线上预览版本504了 HOT 1
- 保姆级文档的网址打不开了 HOT 1
- 文档和预览挂了 HOT 1
- 📢通知!文档站和完整版预览站地址更换!!!
- syntax error : getPackageSize HOT 1
- `segmented`分段控制器尺寸变化问题及 `Element Plus 2.7.0` 新分段器的应用 HOT 3
- 【不是bug】请教一下关于Redialog组件渲染问题 HOT 1
- 菜单中点击外链会跳转两次 HOT 1
- 菜单中点击外链会跳转两次(补充复现条件)
- 组件注册问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-pure-admin.