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] 开启 webpack 5 后,打包物理缓存未生效 #6266

Closed
bluescurry opened this issue Mar 14, 2021 · 8 comments · Fixed by #6335
Closed

[Bug] 开启 webpack 5 后,打包物理缓存未生效 #6266

bluescurry opened this issue Mar 14, 2021 · 8 comments · Fixed by #6335
Assignees

Comments

@bluescurry
Copy link

What happens?

使用 yarn create @umijs/umi-app 创建空项目并开启 webpack5,然后打包,每次打包时间都是10~12s之间,webpack5 提供的物理缓存看起来并未生效,并且打包过程中依然有 warning。

Mini Showcase Repository(REQUIRED)

Please provide a repository using yarn create @umijs/umi-app then upload to your GitHub 请提供一个可复现的仓库,使用 yarn create @umijs/umi-app 创建,并上传到你的 GitHub 仓库

复现仓库:https://github.com/bluescurry/umi-fresh

How To Reproduce

Steps to reproduce the behavior: 1. 2.

Expected behavior 1. 2.

执行yarn run build打包
image

Context

  • Umi Version: 3.4.2
  • Node Version:v14.15.4
  • Platform:MacOS
@bluescurry
Copy link
Author

我升级到了最新的3.4.3,仍然有这个问题,能方便给个回复吗

@sorrycc
Copy link
Member

sorrycc commented Mar 22, 2021

怎么判断物理缓存没有生效?

@bluescurry
Copy link
Author

怎么判断物理缓存没有生效?

每次打包的时间均为12s左右,速度上没有提升,并且在 node_modules 的 .cache 中并没有看到缓存文件

@sorrycc
Copy link
Member

sorrycc commented Mar 23, 2021

cache 在 src/.umi/.cache 下。

@liaoyinglong

This comment has been minimized.

sorrycc added a commit that referenced this issue Mar 25, 2021
* fix: webpack5 build 模式下没有生成物理缓存

see
webpack/webpack#12345 (comment)

Closes #6266

* Update packages/bundler-webpack/src/index.ts

* Update packages/bundler-webpack/src/index.ts

Co-authored-by: chencheng (云谦) <sorrycc@gmail.com>
aquariuslt pushed a commit to aquariuslt/umi that referenced this issue Mar 27, 2021
* fix: webpack5 build 模式下没有生成物理缓存

see
webpack/webpack#12345 (comment)

Closes umijs#6266

* Update packages/bundler-webpack/src/index.ts

* Update packages/bundler-webpack/src/index.ts

Co-authored-by: chencheng (云谦) <sorrycc@gmail.com>
@942368681
Copy link

cache 在 src/.umi/.cache 下。

那在生产环境中其实开启物理缓存并没有什么作用是吧,因为每次部署都不会上传.umi或者.umi-production这个文件夹,也就是每次打包机在构建的时候都不会利用缓存。

@liuhao-hrbust
Copy link

cache 在 src/.umi/.cache 下。

那在生产环境中其实开启物理缓存并没有什么作用是吧,因为每次部署都不会上传.umi或者.umi-production这个文件夹,也就是每次打包机在构建的时候都不会利用缓存。

在生产环境构建机上回一直存在.umi文件夹的,所以会走缓存

@KellenHe
Copy link
Contributor

cache 在 src/.umi/.cache 下。

那在生产环境中其实开启物理缓存并没有什么作用是吧,因为每次部署都不会上传.umi或者.umi-production这个文件夹,也就是每次打包机在构建的时候都不会利用缓存。

在生产环境构建机上回一直存在.umi文件夹的,所以会走缓存

请问是要把.umi文件提交上去吗

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.

6 participants