-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
babel-loader cache won't be updated after updating transpileDep with npm #4438
Comments
I think this PR #3865 fix the problem of vue-loader cache. vue-cli/packages/@vue/cli-plugin-babel/index.js Lines 49 to 58 in 6918792
if I do like this to generate new cache file when lockfiles have been updated , the problem can be solved. But I am not sure if it's elegant.
const variables = {
// ...
configFiles: ''
}
for (const file of configFiles) {
const content = readConfig(file)
if (content) {
variables.configFiles += content.replace(/\r\n?/g, '\n')
}
} |
we could likely just add |
transpiled dependency's version has changed close #4438
@fangbinwei Well, I don't think it's the bug of vue-loader cache or some other packages.Cache loader use mtime of a file to decide to use cache content or not.In your test project(https://github.com/fangbinwei/vue-cli-cache-loader-bug). You can use fs.stasSync api to test your 'sleepwalker-fakezz' package.You will find the mtime of |
Lockfiles have already been taken into account since 3.7.0 so I think it's not related to the cache config. #3865 |
webpack-contrib/cache-loader#34 |
But it only breaks when babel plugin presents… |
😂So it's a bug in the implementation. Lockfiles are not read sometimes. Lockfiles and configFiles need to be treated differently. Config files have priorities so only the first encountered one needs to be read; all lock files should be taken into account. |
follow up of vuejs#3865 fixes vuejs#4438
In the for (const file of configFiles) {
const content = readConfig(file)
if (content) {
variables.configFiles = content.replace(/\r\n?/g, '\n')
break
}
} I just see the code you have commit.You add the Thanks. |
Thanks for your reply @CommanderXL . So it seems that
But for If I place config in dedicated config files, the modification of Suddenly, I found you have changed the implementation 🤣 @sodatea |
* fix: correctly calculate cacheIdentifier from lockfiles follow up of #3865 fixes #4438 * Revert "fix: correctly calculate cacheIdentifier from lockfiles" This reverts commit dbce88b. * fix: should take all configFiles and lockfiles into account The previous implementation is based on the assumption that config files have precendences, e.g. `.eslintrc.js` will take higher precendence over `.eslintrc`, and only one will take effect. This is not accurate however. For example, babel relies on both babel config and browserslist config, so we need to deal with 2 config files.
* fix: correctly calculate cacheIdentifier from lockfiles follow up of vuejs#3865 fixes vuejs#4438 * Revert "fix: correctly calculate cacheIdentifier from lockfiles" This reverts commit dbce88b. * fix: should take all configFiles and lockfiles into account The previous implementation is based on the assumption that config files have precendences, e.g. `.eslintrc.js` will take higher precendence over `.eslintrc`, and only one will take effect. This is not accurate however. For example, babel relies on both babel config and browserslist config, so we need to deal with 2 config files.
Version
4.0.0-beta.3
Reproduction link
https://github.com/fangbinwei/vue-cli-cache-loader-bug
Environment info
Steps to reproduce
git clone to local
What is expected?
the cache of vue-loader and babel-loader both will be updated.
In other words, the page show string
old template old js
before i update transpileDep. I hope the page can show stringnew template new js
if I run dev server after updating transpileDep.What is actually happening?
only vue-loader cache can be updated, but babel loader cache remains the old version.
the page show string
new template old js
. things related with template of .vue can be updated, but js code in <script> of .vue and somewhere else remains the old versionBut, use yarn to install deps, everything is ok. It seems yarn delete the
node_module/.cache
afteryarn add
related issue #3635, #2450
Background
our team use transpileDependencies to import our private library which is released frequently. Team member usually forget to delete cache file after they update library, and get Inexplicable result after running dev server. We use npm because of some history reason.
The text was updated successfully, but these errors were encountered: