Skip to content

feat: keep unknown import.meta properties#20312

Merged
alexander-akait merged 6 commits intomainfrom
importMeta
Jan 16, 2026
Merged

feat: keep unknown import.meta properties#20312
alexander-akait merged 6 commits intomainfrom
importMeta

Conversation

@xiaoxiaojx
Copy link
Member

Summary
Unknown import.meta properties are now determined at runtime instead of being statically analyzed at compile time.

What kind of change does this PR introduce?
Feat

Did you add tests for your changes?
Yes

Does this PR introduce a breaking change?
No

If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: 36b44e7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

This PR is packaged and the instant preview is available (c3ce90b).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@c3ce90b
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@c3ce90b
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@c3ce90b

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 15, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing importMeta (36b44e7) with main (aa63096)

Summary

✅ 72 untouched benchmarks

PLUGIN_NAME,
// unknown import.meta properties should be determined at runtime
() => true
);
Copy link
Member

Choose a reason for hiding this comment

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

Looks good, but let's do it under the option, we have D(parserOptions, "importMeta", true); right now, but we need importMeta: boolean | "preserve-unknown", let's set preserve-unknown when output.module is true, we still should replace it when output.module is false, otherwise code will not work

@@ -0,0 +1,5 @@
---
"webpack": patch
Copy link
Member

Choose a reason for hiding this comment

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

Let's do it under minor

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Thanks

@alexander-akait alexander-akait merged commit c3ce90b into main Jan 16, 2026
90 of 92 checks passed
@alexander-akait alexander-akait deleted the importMeta branch January 16, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants