Skip to content

feat: reduce unnecessary exports runtime#18565

Merged
alexander-akait merged 1 commit intowebpack:mainfrom
fi3ework:reduce-runtime
Jul 10, 2024
Merged

feat: reduce unnecessary exports runtime#18565
alexander-akait merged 1 commit intowebpack:mainfrom
fi3ework:reduce-runtime

Conversation

@fi3ework
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

The initial goal of this PR is to reduce unnecessary runtime code in modern-module. As __webpack_exports__ and related define property runtime is not needed.

Contains following changes:

  1. Explicit define RuntimeGlobals.exports instead of using the always pre-rendered __webpack_exports__ in source, only render it when runtime requirements exist.

    • where RuntimeGlobals.onChunksLoaded is added, also adding RuntimeGlobals.exports
    • Add RuntimeGlobals.exports to lib/library/AssignLibraryPlugin.js and lib/library/ExportPropertyLibraryPlugin.js to inherit the explicit defined RuntimeGlobals.exports runtime.
  2. Do not render RuntimeGlobals.exports & RuntimeGlobals.definePropertyGetters in modern-module mode.

Did you add tests for your changes?

Yes.

Does this PR introduce a breaking change?

I don't think so. __webpack_exports__ is striped only when is useless.

What needs to be documented once your changes are merged?

No.

@webpack-bot
Copy link
Copy Markdown
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants