question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vue-cli-service build does not update or invalidate node_modules/.cache, resulting in broken build

See original GitHub issue

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 --modern builds 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:16 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
marosivancocommented, Sep 24, 2018

Workaround: npm install rimraf --save-dev

In package.json add the prebuild script:

...
"prebuild": "node ./node_modules/rimraf/bin.js ./node_modules/.cache",
"build": "vue-cli-service build --modern",
..

Kind of clumsy, but better than corrupted build.

4reactions
LinusBorgcommented, Dec 10, 2018

“There are two hard problems in programming: naming things, and caching.”

What options do we have?

  • We could add package.json’s dependencies, devDependencies and peerDependencies fields as inputs to the chache-key generating code (e.g. here. But that wouldn’t work for updated nested dependencies (i.e. clearing yarn.lock and reinstalling, adding updated dependencies in the process
  • We could add a postinstall script that purges the cache whenever anything is installed into the project (is that possible?)
  • We could document this, and add a command/flag to easily purge the cache manually (vue-cli-service build --clearCache or something).

Other ideas? @sodatea

Read more comments on GitHub >

github_iconTop Results From Across the Web

Compiling error when building Vue project after Node/dev ...
Unfortunately I have no other ideas on this issue for the moment, I believe it is a breaking change that occurred when you...
Read more >
@vue/cli-service | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Mastering Browser Cache - Vue School Blog
Learn how to master browser cache to improve the performance of your Vue.js applications.
Read more >
just an fyi, delete your .cache folder before release build : r/vuejs
Delete .cache folder in node_modules before building release version. ... Dev version was working perfectly but Prod build did not.
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
(was: =dev-java/jdbm-1.0 is available)" status:RESOLVED resolution:OBSOLETE ... Bug:123318 - "net-dns/avahi won't build w/o X connection (related to pygtk)" ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found