Skip to content
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

打包成lib库后,导入主应用中,浏览器一直报Uncaught TypeError: Cannot read properties of undefined (reading 'pushScopeId') #7423

Open
VVzhouxiaobai opened this issue Sep 6, 2023 · 3 comments

Comments

@VVzhouxiaobai
Copy link

Version

5.0.8

Environment info

package.json配置vue-cli-service build --mode production --dest dist --target lib --name sjzl ./src/entry.js

Steps to reproduce

直接npm run build后把打包的库通过script链接和link样式引入主应用中,然后就报上述错误

What is expected?

我发现那个错误就是打包后的__webpack_require__(7203)这句没有获取到

What is actually happening?

就是vue3+webpack打包后在引用就报上述错误

@Wnagfeng
Copy link

Wnagfeng commented Feb 7, 2024

我测试了几个版本
最开始我以为是ts问题
用webpack+ts 和webpack+js都试了一下webpack都没问题
当我回到vite+ts 就有问题了 最开始报错是找不到导出语句 后来我换了导入语句
import * as datav from 'echarts-screen-libs'
果然不报错
但是浏览器还是不能运行
报错如下
screendatav.js:11 Uncaught TypeError: Cannot read properties of undefined (reading 'pushScopeId')
at _withScopeId (screendatav.js:11:36)
at screendatav.js:13:38
at screendatav.js:4:101
at screendatav.js:5:3

@Wnagfeng
Copy link

Wnagfeng commented Feb 7, 2024

还是没解决 如果还是不行 我就不用vite了用webpack去了

@Wnagfeng
Copy link

Wnagfeng commented Feb 7, 2024

最新解决 我刚刚看到一篇文章 rollup不支持 scoped了 去掉scoped后 报错变成了 Cannot read properties of undefined (reading 'createElementVNode')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants