-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Webpack5 File caching cannot be used in production mode with custom compilers #12345
Comments
For maintainers only:
|
You need run |
Wow, that's cool! It worked. My second build time was reduced by 80%! Thank you very much! |
* 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>
@alexander-akait I found this doc not very clear regarding when we should use close() or not: https://webpack.js.org/api/node/#webpack It somehow let us think that close() is only useful for the watch mode, maybe it would be useful to add an example using run() ? |
@slorber Yes, feel free to open an issue or send a PR |
* 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>
Bug report
I have submitted this question in stackoverflow, but I haven't received any reply。
https://stackoverflow.com/questions/65556873/why-cant-my-webpack5-configuration-use-filesystem-cache-in-production-mode
What is the current behavior?
First, I use a custom compiler like "const compiler = webpack (config)"; compiler.run () ”。
Second, I have successfully upgraded to webpack 5 and have been able to compile successfully in production mode.
Third, I use the persistent caching mechanism of webpack5 in production mode, and configure it according to the following configuration, hoping to integrate it into our CI process.
Fourth, I found that the cache file could not be generated in my directory as expected. There was no difference in the build time between the first build and other builds. It seems that the cache was not successfully used.
Fifthly, I use the development mode, the same webpack configuration, and start the service through webpack dev server. I can generate the cache file as expected, and the other times of construction time is much less than the first time. It seems that the cache is successful.
cache: { name:"testCache", type: 'filesystem', cacheDirectory: path.resolve(paths.cachePath,'webpackcache'), },
If the current behavior is a bug, please provide the steps to reproduce.
Because of the problem of office environment, I can't code to GitHub warehouse. All I can offer is a few configuration fragments
What is the expected behavior?
File caching can be used successfully in production mode.
Other relevant information:
webpack version: 5.11.0
Node.js version: v10.15.3
Operating System: window 10
Additional tools:
The text was updated successfully, but these errors were encountered: