Skip to content
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

Allow import.meta.url when module is node16 or node18 #61441

Open
benmccann opened this issue Mar 17, 2025 · 2 comments
Open

Allow import.meta.url when module is node16 or node18 #61441

benmccann opened this issue Mar 17, 2025 · 2 comments
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@benmccann
Copy link
Contributor

benmccann commented Mar 17, 2025

🔎 Search Terms

import.meta' meta-property '--module' option 'es2020' 'es2022' 'esnext' 'system' 'node12' 'nodenext'

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about the module option

⏯ Playground Link

https://www.typescriptlang.org/play/?moduleResolution=99&target=99&module=100&ts=5.8.2#code/MYewdgziA2CmB00QHMAUBLAtgBxAJwBd5NYCBDeAVz2gEoBuAWACgg

💻 Code

console.log(import.meta.url);

🙁 Actual behavior

When setting the module option to node16 or node18 you get the error message:

The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node12', or 'nodenext'.

🙂 Expected behavior

node16 and node18 should be supported. import.meta.url is available in those versions of Node and it makes no sense that this setting would say that it's available in Node 12 and the latest version of Node, but not the intermediate versions of Node.

Additional information about the issue

No response

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Mar 17, 2025

Bug workbench repros:

@module: node16
// @module: node16
// @moduleResolution: node16
console.log(import.meta.url);

Workbench Repro

@module: node18
// @module: node18
// @moduleResolution: node16
console.log(import.meta.url);

Workbench Repro

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Mar 17, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 17, 2025
@ExE-Boss
Copy link
Contributor

@typescript-bot run repros

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants