-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
fix ExportsInfo #15367
fix ExportsInfo #15367
Conversation
For maintainers only:
|
- should mark every export canMangleProvide=false if there are unknown exports - add __webpack_exports_info__.<name>.canMangle to api - add test case
69b6fca
to
4830503
Compare
@@ -3274,7 +3274,7 @@ cacheable modules 1.22 KiB | |||
ModuleConcatenation bailout: Module is not an ECMAScript module | |||
webpack x.x.x compiled successfully in X ms | |||
|
|||
asset main.no-side.js 979 bytes [emitted] [minimized] (name: main) | |||
asset main.no-side.js 993 bytes [emitted] [minimized] (name: main) |
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.
no mangling for one variable (same case with empty js file)
const exportsInfo = moduleGraph.getExportsInfo(module); | ||
const exportInfo = exportsInfo.getExportInfo(exportName); | ||
if (exportInfo) return exportInfo.canMangle; | ||
return exportsInfo.otherExportsInfo.canMangleProvide; |
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.
Why is that canMangleProvide
and not canMangle
?
return exportsInfo.otherExportsInfo.canMangleProvide; | |
return exportsInfo.otherExportsInfo.canMangle; |
@@ -0,0 +1,2 @@ | |||
/** @type {import("../../../../").Configuration} */ | |||
module.exports = {}; |
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.
When this doesn't need special config, we should move it into test/cases
so it's tested with different configs.
Maybe wrapping some assertions with if(process.env.NODE_ENV === "production")
(e. g. for optimizations that only run in production mode)
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.
this was done intentionally to run 3 times (check for cache invalidation)
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.
Ah yes that makes sense
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.
moved to test/cases
added cache invalidation stuff there as well
test/TestCasesCachePack.longtest.js
Outdated
test: "no-string" | ||
}, | ||
{ | ||
// Pack got invalid because of write to: ResolverCachePlugin|normal|dependencyType=|esm|path=|/Users/ivankopeykin/Repositories/webpack/test/cases|request=|./large/big-assets/ |
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.
fix in #15373
infrastructureLogErrors: { | ||
compile: { | ||
// Module build failed | ||
["error-hide-stack"]: |
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.
maybe add this to errors.js
file? cache-errors.js
maybe?
filter: [logErrors.PERSISTENCE_CACHE_INVALIDATE_ERROR] | ||
wasm: { | ||
// Can not compile wasm module | ||
["missing-wasm-experiment"]: |
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.
["missing-wasm-experiment"]: | |
"missing-wasm-experiment": |
That's not necessary... but you can leave that for now
82cc542
to
e4e9b7f
Compare
e4e9b7f
to
dc73156
Compare
Thanks |
I've created an issue to document this in webpack/webpack.js.org. |
canMangleProvide=false
if there are unknown exports__webpack_exports_info__.<name>.canMangle
to apiWhat kind of change does this PR introduce?
bugfix
fixes #15214
Did you add tests for your changes?
yes
Does this PR introduce a breaking change?
no
What needs to be documented once your changes are merged?
add
__webpack_exports_info__.<name>.canMangle
to api