Skip to content

add __webpack_module__ and __webpack_module_id__ to the api#15282

Merged
sokra merged 1 commit intomainfrom
feature/__webpack_module__
Jan 31, 2022
Merged

add __webpack_module__ and __webpack_module_id__ to the api#15282
sokra merged 1 commit intomainfrom
feature/__webpack_module__

Conversation

@sokra
Copy link
Copy Markdown
Member

@sokra sokra commented Jan 31, 2022

What kind of change does this PR introduce?
feature

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?

  • __webpack_module__ equals to module but is always available (module is not available in strict ESM)
  • __webpack_module_id__ equals to module.id but is always available (module is not available in strict ESM)

@webpack-bot
Copy link
Copy Markdown
Contributor

webpack-bot commented Jan 31, 2022

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)

@webpack-bot
Copy link
Copy Markdown
Contributor

I've created an issue to document this in webpack/webpack.js.org.

Comment thread lib/APIPlugin.js
);

parser.hooks.expression
.for("__webpack_module_id__")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe __webpack_module__.id this looks more natural + we could want add another property like __webpack_module__[property]

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

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