-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add lazy/eager cache key to avoid invalid change when switching modes #9518
Conversation
There's also a cache key in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Was the approach just to find everywhere that mode
was used in a cache key and add it there?
@@ -665,7 +665,8 @@ export default class PackagerRunner { | |||
bundleGraph.getHash(bundle) + | |||
JSON.stringify(configResults) + | |||
JSON.stringify(globalInfoResults) + | |||
this.options.mode, | |||
this.options.mode + | |||
`${this.options.shouldBuildLazily ? 'lazy' : 'eager'}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/nit but this doesn't really need to be a template string.. (but I get that you probably just copied what you did in all the other places, no big deal..)
@@ -6788,4 +6790,43 @@ describe('cache', function () { | |||
let res = await run(build.bundleGraph); | |||
assert.deepEqual(res, {default: 'foo'}); | |||
}); | |||
|
|||
it('invalidates correctly when switching from lazy to eager modes', async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this was a failing test before your changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it was!
Yep, I also looked at the Parcel version variable |
0aa9f8f
to
a391e4b
Compare
↪️ Pull Request
Simple change to consider whether lazy mode is enabled/disabled. This is required because launching with
--lazy
, then re-launching without--lazy
will cause build errors.🚨 Test instructions
yarn parcel --lazy
yarn parcel