Skip to content

[Feature]: Support import.meta.resolve + Node Specific Meta Values #8008

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

Open
joealden opened this issue Sep 27, 2024 · 6 comments · May be fixed by #10573
Open

[Feature]: Support import.meta.resolve + Node Specific Meta Values #8008

joealden opened this issue Sep 27, 2024 · 6 comments · May be fixed by #10573
Labels
feat New feature or request PR welcome

Comments

@joealden
Copy link

What problem does this feature solve?

Node recently added support for the following (currently in RC status):

As webpack + rspack already handle import.meta.url, I feel like it wouldn't be too much of a stretch to support these?

Currently in rspack:

  • import.meta.dirname is replaced by /* unsupported import.meta.dirname */ undefined
  • import.meta.filename is replaced by /* unsupported import.meta.filename */ undefined
  • import.meta.resolve is replaced by ({}).resolve

I'm not sure how webpack handles this today, but it might be worth aligning with the webpack team regardless? And even if we can't support these (in the short term or long term), should the built no error/warn if these are encountered?

What does the proposed API of configuration look like?

I guess maybe node.__filename and node.__dirname could impact these (see https://rspack.dev/config/node), or new options could be added (either generic node.filename and node.dirname properties that handle both CJS and ESM, or a new node.import property just for ESM)?

@joealden joealden added feat New feature or request pending triage The issue/PR is currently untouched. labels Sep 27, 2024
Copy link

stale bot commented Nov 26, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Nov 26, 2024
@joealden
Copy link
Author

Bump

@LingyuCoder LingyuCoder added PR welcome and removed pending triage The issue/PR is currently untouched. stale labels Dec 4, 2024
Copy link

stale bot commented Feb 2, 2025

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Feb 2, 2025
@joealden
Copy link
Author

joealden commented Feb 2, 2025

Bump

@stale stale bot removed the stale label Feb 2, 2025
Copy link

stale bot commented Apr 3, 2025

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Apr 3, 2025
@joealden
Copy link
Author

joealden commented Apr 3, 2025

Bump

@stale stale bot removed the stale label Apr 23, 2025
@magic-akari magic-akari linked a pull request Jun 5, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request PR welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants