-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[dynamic-import-chunkname] Disallow chunk name when eager mode is enabled #3004
Conversation
When would you not want this option enabled? |
Never, really. I'll just make it the default. |
…Mode: 'eager' is set; add suggestions to remove name in eager mode'
db3c637
to
2b626fb
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3004 +/- ##
==========================================
+ Coverage 95.66% 95.87% +0.20%
==========================================
Files 78 78
Lines 3275 3293 +18
Branches 1150 1156 +6
==========================================
+ Hits 3133 3157 +24
+ Misses 142 136 -6 ☔ View full report in Codecov by Sentry. |
Is there anyone who this could break? I assume not, because the only complaint would be that it fails to warn on something? |
Exactly, this only suppresses existing warnings in a narrow case, and doesn't introduce new warnings. |
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.
Thanks, this is great!
One more enhancement we may want to consider before landing this: when webpackMode is eager, and a useless name is present, could we give a suggestion to remove the name?
@ljharb Yeah that makes sense to me, just updated the PR to warn when chunk name and eager mode are both set. |
cb74902
to
340c8f2
Compare
@amsardesai sorry if i wasn't clear; a "suggestion" isn't prose giving the user a hint, it's an actual eslint feature where the editor will prompt them with multiple autofixes they have to explicitly choose. For an example, look for a rule with |
Ah, I didn't realize you meant ESLint suggestions. Let me do that. |
Hey @ljharb, would love to know if this can be merged now, or if any other changes need to be made! |
7173569
to
a655f36
Compare
@amsardesai ok, i've rebased this and it's probably ready to go :-) (assuming tests pass) just wondering about some of the remaining test changes (not the additions, those make sense) - some are lazy → eager, and some are eager → lazy. Can you go through and comment in the PR on those lines, and explain what motivated the change? i suspect you have a convincing explanation for them all but this way it'll be documented for me in the future :-) |
a655f36
to
898ce3b
Compare
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.
Also updated some tests to be a bit more thorough!
48c921c
to
a3a7176
Compare
Hey @ljharb, would love to know when you will put out a new release - I'm hoping to use the changes in this PR in our repo. |
I was hoping to get flat config support landed before cutting a release; I'll plan to cut one within the next couple of weeks regardless. |
Thanks for the update! |
Hey @ljharb, just pinging again to check if you will release soon, since it's been 8 months since the last release. |
@amsardesai i'll probably have to cut a release without flat config support, sadly, so i'd expect one in the next few weeks. |
The dynamic-import-chunkname rule is useful for catching missing chunk names for imports, however much of our imports use
webpackMode: "eager"
to disable creating a separate chunk (i.e for lazy evaluation). AddingwebpackChunkName
anyway can force webpack to generate a chunk, defeating the purpose of the eager mode. This PR changes the rule to disallow chunk names whenwebpackMode: "eager"
is set.Related issue: #1904