-
Notifications
You must be signed in to change notification settings - Fork 71
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
Same cache dir between multiple projects errors with parallel usage #15
Comments
A workaround would be to give each process its own cache, for example with typescript({ cacheRoot: `.cache_${process.pid}` }) This will create new cache for every run, so not a long term workaround, unless you also add a step to clean those up. I'll look into using target names in cache path later. |
BTW, if you manage to make it work with separate caches, check if your parallel execution makes a difference -- seems like rollup does one transpiling and then makes bundles for different targets from its own memory cache. So depending on which plugins you are using (transpile work heavy or bundle work heavy) you might not gain much speed up, because you would force rollup to retranspile for each target. |
Thanks for your comments!
I am not sure what you mean by different targets - as far as I can tell, rollup can only create one bundle at a time (here is an issue: rollup/rollup#863). So if I want multiple bundles, I must run it multiple times? |
BTW, there is something strange in public write(name: string, data: DataType): void
{
if (this.rolled)
return;
if (data === undefined)
return;
if (this.rolled)
fs.writeJsonSync(`${this.oldCacheRoot}/${name}`, data);
else
fs.writeJsonSync(`${this.newCacheRoot}/${name}`, data);
} The second |
Yep, looks like left overs after watch fix, thanks! I assumed you were building different targets in parallel from the same code somehow... (for example this plugin builds 2 bundles in cjs and es formats). Are you saying you have multiple whole rollup configs and they conflict when getting built at the same time? Could you post how you have it setup in guilp? Might be able to simply hardcode different cache roots, and then they shouldn't conflict. |
Yes, that's what I meant - entirely different bundles, not multiple targets (I never noticed this functionality in rollup at all - sorry for the confusion). Following your suggestion, I used the following: cacheRoot: process.cwd() + `/.rpt2_cache/${app.name}`, (where So I think the issue is clear - a single cache directory cannot be used concurrently - and the solution is to use different cache directories. So we can close this issue, unless you want to make it work transparently in some fashion. Thanks! |
Cool, I'll add hash of rollup config itself to the cache path, should handle a number of possible conflicts. |
Partial solution for #15 and a number of other potential conflicts.
Ok, 0.4.1 should behave better in this case out of the box (if contents of your rollup configs actually differ). |
I am running into this on v 0.31.2. My use case is applying the same rollup config to a number of different files via use of an environment variable, as can be seen in the PR linked just above. Interestingly, I only see these error messages if I pass the |
Given that now most of our testing runs in parallel in CI, the biggest bottleneck has become the build step. Within that step, the single slowest thing we do is build integration bundles, simply because of the number of bundles which need to be created. (This is especially true now that we're creating three versions of each bundle rather than two[1].) To speed things up a bit, this parallelizes the building of those bundles. Though it ends up not being as dramatic a time savings as one might hope (because the typescript plugin's caching mechanism doesn't play nicely with concurrent builds[2]), it nonetheless drops the total build time from roughly two minutes down to 70-80 seconds in my local testing. [1] #4699 [2] ezolenko/rollup-plugin-typescript2#15
@lobsterkatie after this issue was closed, the hash for caches now includes the entire Rollup config. If you're changing the Otherwise, as mentioned above, you can override If you're experiencing an unexpected issue still, please file a new issue and fill out the issue template. Locking as the original issue was resolved. |
My build system creates 3 bundles with rollup. If I build each bundle serially, it succeeds. However, if I build them concurrently (e.g. with
make -j4
,gulp
, ...), it fails like this:I can try to provide a reproducer, if needed.
These are the relevant package versions:
Thanks.
The text was updated successfully, but these errors were encountered: