-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vite + Vue app throws error that cannot read property '$isServer' of undefined on fresh install #3370
Comments
vite v2.2.4 用着好好的.今天开个新项目就哦豁. |
我是把vite升级到最新的2.3.2,在项目的package.json里边把esbuild降级到0.10.2,然后手动复制 esbuild [0.10.2]版本到 node_modules\vite\node_modules\esbuild目录下边。 esbuild 0.11.0版本开始,import动态生成的代码逻辑变了。 |
一样的bug,请问解决了吗? |
尝试了,不起作用 |
把原来的node_modules删掉, esbuild-windows-64 这个也要引用进来,不然没有esbuild.exe。 "esbuild": "0.10.2", |
这个方法尝试过了,无效 |
我今天也遇到这个问题了,但是解决办法稀里糊涂的。 |
2.2.4正常,2.3.0就异常了,我一排查下commit,发现是这个esbuild更新导致的。临时可以先把vite切换回2.2.4版本 测试2.3.3源码手动指定esbuild: 0.9.3,编译后,这个错误也不会出现 05fd1e2#diff-949e137b027a941e9a8dabb980971ab5b7147f895fc06ab2ff0bb0923d981606 补充: 更新esbuild会导致初始化node_modules包到.vite时的代码不一样,详情查看, 我是用element-ui 2.15.1出现这个问题,我测试vue3+element plus是正常的。应该是element-ui的使用方式不正确导致的 I have this problem with element-ui 2.15.1. I tested vue3 + element plus and it work. It should be caused by incorrect use of element-ui 修复方法(How to Fix)
|
有个兄弟使用插件修复了此问题 https://www.npmjs.com/package/esbuild-plugin-vite-element-ui |
还有一种解决办法,通过cdn方式引入vue、vue-route和element-ui可行 |
Can't reproduce this in the latest version now. |
Describe the bug
When initializing a fresh Vue app with Vite, I keep getting an error when running the dev server. This seems to be a 2.3.0 regression as it doesn't happen with 2.2.4.
Reproduction
System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager:
Logs
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: