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

[BUG] Vue CLI 5项目中Webpack插件错误 #2798

Open
nayonglin opened this issue Nov 8, 2023 · 5 comments · Fixed by #2800
Open

[BUG] Vue CLI 5项目中Webpack插件错误 #2798

nayonglin opened this issue Nov 8, 2023 · 5 comments · Fixed by #2800

Comments

@nayonglin
Copy link

问题描述:
在Vue CLI 5项目中使用Qiankun webpack插件时遇到两个主要问题:

  1. 入口JS文件识别不准确: Vue CLI 5默认配置下的html-webpack-plugin会将编译后的JS文件放置在head标签末尾,并添加defer属性。Qiankun插件目前的逻辑是识别最后一个非defer或async的script标签作为入口JS,这导致了识别错误。

  2. webpack版本识别失败: 由于业务项目的package.json中未直接包含webpack依赖,插件无法读取到当前业务仓库使用的webpack版本,导致插件运行出错。

复现步骤:

  1. 使用Vue CLI 5创建一个新项目。
  2. 在项目中使用Qiankun webpack插件。
  3. 运行构建命令并检查生成的HTML文件。

预期行为:

  • 插件应准确识别带有defer属性的入口JS文件。
  • 插件应能够正确读取或推断出项目使用的webpack版本。

实际行为:

  • 插件未能识别带有defer属性的正确入口JS文件。
  • 在缺少直接webpack依赖的情况下,插件无法确定使用的webpack版本。

建议的解决方案:

  • 修正Qiankun插件的识别逻辑,以兼容html-webpack-plugin的defer行为。
  • 允许在插件配置中明确指定webpack版本,或改进插件的版本检测逻辑,以处理幽灵依赖的情况。
Copy link

github-actions bot commented Nov 8, 2023

由于缺乏足够的信息(github、stackblitz、codesandbox等可复现仓库),我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。如果只是单独的技术咨询,可移步 https://qiankun.umijs.org/#-community 交流~

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2023
@nayonglin
Copy link
Author

nayonglin commented Nov 8, 2023

#2800

@kuitos kuitos reopened this Nov 8, 2023
@kuitos
Copy link
Member

kuitos commented Nov 8, 2023

我记得webpack是有API获取到实际的版本的

@nayonglin
Copy link
Author

我记得webpack是有API获取到实际的版本的

社区找了一圈,也断点看了运行时的对象,没看到的样子😂

@kuitos
Copy link
Member

kuitos commented Nov 8, 2023

webpack/webpack#15526

@kuitos kuitos linked a pull request Nov 15, 2023 that will close this issue
4 tasks
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

Successfully merging a pull request may close this issue.

2 participants