3.0.1
node v8.9.3 / npm 6.4.1 / Windows 10
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"]
vue-cli-service build --modern
builds app and creates node_modules/.cachenpm update B
, which updates node_modules/B vue-cli-service build --modern
A/dist should correspond to A's and B's sources.
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.
Please provide a reproduction as required in the issue form that you filled out.
The reproduction requires more then one repository and publishing to npm. I was hoping for an aha effect, but ok, I will try to create some sort of reproduction.
Is it ok if I attach zip with both projects?
that would be apprechiated, yes. a github repository (with both projects in subfolders) would be even easier.
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 [email protected]. But when I delete cache:
In a:
Which is expected behavior.
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.
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.
I too experienced this issue with a node_module package containing vue components. None of the consuming projects of that node_module package were being updated even though npm update was ran on the project and the latest version was downloaded.
Once I rimraf ./node_modules/.cache
things were updated.
"There are two hard problems in programming: naming things, and caching."
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 processvue-cli-service build --clearCache
or something).Other ideas? @sodatea
This way (and also the postinstall script option) the generated project would work out of box, even for the source dependencies.
Current behavior is nasty in a way, that you know there is an issue, only after the build lands the test environment. And even then it is difficult to link it to the cache.
I am having bad cache problems too.
That doesn't really tell us much, I have to say ...
I don't know what the issue was but it seems to have fixed itself using another terminal.
I have the similar issue. My build was always generating an outdated build with old dependencies. The package folder in node_modules had the correct version, but it seems the cache was a problem. I had to delete the whole node_modules folder + package_lock.json (maybe clearing cache would have been enough though, but haven found this issue only afterwards) and reinstall the dependencies to get a fresh and up-to-date build.
@LinusBorg what about just checksum of package-lock.json or yarn.lock?
I use this solution as workaround for now:
const hash = require('hash-sum');
const packageLock = require('../package-lock');
['ts', 'js'].forEach((rule) => {
config.module.rule(rule)
.use('cache-loader')
.tap((options) => {
options.cacheIdentifier = hash({
oldHash: options.cacheIdentifier,
packageLock,
});
return options;
});
});
I think this should be fixed now by #3865
Have the same issue.
"@vue/cli": "^4.4.1",
"@vue/cli-plugin-babel": "^4.4.1",
"@vue/cli-plugin-eslint": "^4.4.1",
"@vue/cli-plugin-unit-mocha": "^4.4.1",
"@vue/cli-service": "^4.4.1",
transpileDependencies: ['qxjs']
Most helpful comment
Workaround:
npm install rimraf --save-dev
In package.json add the prebuild script:
Kind of clumsy, but better than corrupted build.