feat: support import.meta style module variables#14539
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6319acc1c0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR adds import.meta.rspack* aliases that expose selected Rspack runtime globals via import.meta, implemented within ImportMetaPlugin, and introduces a new config-case test to validate the behavior.
Changes:
- Refactors
ImportMetaPluginto drive supportedimport.meta.*APIs from a centralized static table and adds newimport.meta.rspack*runtime-backed aliases. - Refactors
APIPluginruntime API identifier handling to use per-API function pointers instead of an enum mode. - Adds a new
module-variablesconfig case to cover the newimport.meta.rspack*aliases.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/rspack-test/configCases/module-variables/import-meta-rspack-runtime/rspack.config.js | Adds a config-case setup (notably output.publicPath) for the new import.meta runtime alias test. |
| tests/rspack-test/configCases/module-variables/import-meta-rspack-runtime/index.js | Adds assertions validating the new import.meta.rspack* alias surface. |
| crates/rspack_plugin_javascript/src/parser_plugin/import_meta_plugin.rs | Introduces the API table and implements the new import.meta.rspack* runtime alias handling. |
| crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs | Simplifies runtime API identifier handling via function pointers and keeps existing behaviors (e.g. __webpack_layer__). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
❌ Size increased by 8.00KB from 67.88MB to 67.89MB (⬆️0.01%) |
Merging this PR will not alter performance
Comparing Footnotes
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 popular-libsPath:
📁 react-10kPath:
📁 react-1kPath:
📁 react-5kPath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 322eaae6ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
import.meta style module variables
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce5089969e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d87ca6fe7d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
3b02e61 to
44faa73
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44faa73513
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cce1130853
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a092177557
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
import.meta.rspack*aliases for selected rspack runtime module variablesimport_meta_pluginRuntime alias mapping
import.metaAPIimport.meta.rspackPublicPath__webpack_public_path__import.meta.rspackBaseUri__webpack_base_uri__import.meta.rspackShareScopes__webpack_share_scopes__import.meta.rspackInitSharing__webpack_init_sharing__import.meta.rspackNonce__webpack_nonce__import.meta.rspackUniqueId__rspack_unique_id__import.meta.rspackVersion__rspack_version__import.meta.rspackHash__webpack_hash__