vue-cli: vue-cli-service build does not update or invalidate node_modules/.cache, resulting in broken build
Version
3.0.1
Node and OS info
node v8.9.3 / npm 6.4.1 / Windows 10
Steps to reproduce
I have the app A which has dependency B. A uses B’s sources, thus B is in vue.config.js as transpiled:
transpileDependencies: ["B"]
- in A:
vue-cli-service build --modernbuilds app and creates node_modules/.cache - in B: change code, increase version, and publish it to npm repo
- in A: change B’s version in package.json
- in A:
npm update B, which updates node_modules/B - in A: increase version
- in A:
vue-cli-service build --modern
What is expected?
A/dist should correspond to A’s and B’s sources.
What is actually happening?
A/dist is the same (same hashes, same content), as in the previous build
If I manually delete node_modules/.cache, and run the build again, then it works - the dist content corresponds to the sources.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (4 by maintainers)
Commits related to this issue
- Hope to finally fix the build, see https://github.com/vuejs/vue-cli/issues/2450 — committed to Open-EO/openeo-processes-docgen by m-mohr 5 years ago
Workaround:
npm install rimraf --save-devIn package.json add the prebuild script:
Kind of clumsy, but better than corrupted build.
What options do we have?
dependencies,devDependenciesandpeerDependenciesfields as inputs to the chache-key generating code (e.g. here. But that wouldn’t work for updated nested dependencies (i.e. clearingyarn.lockand reinstalling, adding updated dependencies in the processvue-cli-service build --clearCacheor something).Other ideas? @sodatea
FWIW, we have the same problem when updating packages containing custom Vue components, even in development. Old versions are still displayed until we nuke the cache.
Here is the zip with both projects reproduction.zip Note on how I created it:
In b:
In a:
OK so far, now the change:
In b:
In a:
Not OK, the text should display B@0.2.0. But when I delete cache:
In a:
Which is expected behavior.