Skip to content

feat(wip): add filesystem cache config for webpack 5 - #6323

Draft
haoqunjiang wants to merge 8 commits into
vuejs:devfrom
haoqunjiang:feat-webpack-5-cache
Draft

haoqunjiang wants to merge 8 commits into
vuejs:devfrom
haoqunjiang:feat-webpack-5-cache

Conversation

@haoqunjiang

@haoqunjiang haoqunjiang commented Mar 1, 2021 •

Copy link
Copy Markdown
Member

New:

  • Turn on filesystem cache by default in webpack 5
  • An addBuildDependencies plugin API for plugins to add additional
    dependencies to the cache config

To Fix:

  • Need to implement a --no-cache option for both serve and build
    command
  • Maybe we should hide the implementation behind a --experimental-cache flag first
  • Need to decide how to deal with .js config files when a random
    environment variable change may affect its exports
  • lintOnSave option needs an overhaul to work better with webpack 5
    and the new cache mechanism
  • Not sure how to test the cache implementation

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

Due to the may-be-buggy cache configuration, it should be considered as a breaking change.

  • Yes
  • No

Other information:

New:
- Turn on `filsystem` cache by default in webpack 5
- An `addBuildDependencies` plugin API for plugins to add additional
dependencies to the cache config

To Fix:
- Need to implement a `--no-cache` option for both `serve` and `build`
command
- Need to decide how to deal with `.js` config files when a random
environment variable change may affect its exports
- `lintOnSave` option needs an overhaul to work better with webpack 5
and the new cache mechanism
- Not sure how to test the cache implementation
@fangbinwei

Copy link
Copy Markdown
Collaborator

lintOnSave option needs an overhaul to work better with webpack 5 and the new cache mechanism

Some information about lintOnSave needs to be taken into account

When we set lintOnSave: true, CLI will pass emitWarning: true, emitError: false to eslint-webpack-plugin.

In eslint-webpack-plugin@2.4.3, it will emit all eslint error as compilation warning.

But after 2.5.0webpack/diagnostics-webpack-plugin#46 , it will only emit eslint warning as compilation warning, and doesn't report eslint error. We couldn't see eslint rule error message in console totally, the behavior of emitError and emitWarning is just like its name.

And I believe we can use the default value true of both emitError and emitWarning, and using failOnError, failOnWarning instead according to webpack/diagnostics-webpack-plugin#72 webpack/diagnostics-webpack-plugin#85

The version of eslint-webpack-plugin is pinned to 2.4.3 in #6291, Is there more information about this?

@haoqunjiang

Copy link
Copy Markdown
Member Author

And I believe we can use the default value true of both emitError and emitWarning, and using failOnError, failOnWarning instead according to webpack-contrib/eslint-webpack-plugin#72 webpack-contrib/eslint-webpack-plugin#85

Yeah, I think so.

The version of eslint-webpack-plugin is pinned to 2.4.3 in #6291, Is there more information about this?

Somehow the newest version won't re-lint when I run yarn serve the second time in my test project. Haven't figure out the reason yet. But I guess it's related to this PR: webpack/diagnostics-webpack-plugin#67

@haoqunjiang haoqunjiang mentioned this pull request Apr 9, 2021
14 of 18 tasks
@githoniel

githoniel commented Aug 12, 2021 •

Copy link
Copy Markdown
Contributor

I think we should add more file to buildDependencies like babel.config.js, tsconfig.json etc.

For this moment it is best to turn it off by default. It always warning about resolution fail and something not support serialize and will print many error stack

@yoyo837

yoyo837 commented Sep 7, 2022

Copy link
Copy Markdown

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants