-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
feat: warn when modules are automatically converted to strict mode #19628
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
base: main
Are you sure you want to change the base?
Conversation
|
I'm not sure if this matches the original intent of the TODO, so I'd appreciate your review and guidance. |
CodSpeed Performance ReportMerging #19628 will degrade performances by 30.97%Comparing Summary
Benchmarks breakdown
|
bca8a2b to
5318930
Compare
|
@alexander-akait
as discussed in 17121. |
|
@3ru This is a slightly different task, we need to check if a module can be converted to |
|
@alexander-akait Should we add this warning feature via a plugin, or are we building it directly into the core? |
- Add WarnStrictModeModulesPlugin to detect modules converted to strict mode - Track modules with explicit 'use strict' to avoid false warnings - Plugin is opt-in to avoid breaking existing builds
5318930 to
ea2182a
Compare
698d6f4 to
e516bc5
Compare
e516bc5 to
bcfb3d8
Compare
|
@3ru Great job, honestly automatic transformation would be useful, but it take the time, so right now I think we can -
|
75bb77c to
8d749b7
Compare
bf82e5f to
c17eb5e
Compare
|
✅ |
c17eb5e to
584c818
Compare
584c818 to
23fb6a5
Compare
Resolved conflicts in: - declarations/WebpackOptions.d.ts: Kept strictModeChecks property and added extensibility with [k: string]: any - schemas/WebpackOptions.check.js: Regenerated with yarn fix:special
|
I'll resolve the conflicts after review, since we keep running into them. |
This PR introduces strict-mode compatibility diagnostics to help developers safely migrate modules that will be executed in strict mode and/or emitted as ESM.
Rel #17121
What kind of change does this PR introduce?
StrictCompatibilityPluginparser.isVariableDefinedfor exact scope checksDetection (ECMA-262 Annex C)
Strictness-sensitive patterns are classified into:
Note: Some of these are rejected by Acorn in strict mode before plugin hooks (they appear as Module parse failed), which is expected and relied upon.
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
no
Might be good to write docs?