Skip to content

feat: support import.meta.url shim for CJS #216

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

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Conversation

fi3ework
Copy link
Member

@fi3ework fi3ework commented Sep 18, 2024

Summary

This Rsbuild plugin will shim import.meta.url for CommonJS modules.

  • Replace import.meta.url with importMetaUrl.
  • Inject importMetaUrl to the end of the module (can't inject at the beginning because of "use strict";).
    This is a short-term solution, and we hope to provide built-in polyfills like node.__filename on Rspack side.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copy link

netlify bot commented Sep 18, 2024

Deploy Preview for rslib canceled.

Name Link
🔨 Latest commit 2f6be01
🔍 Latest deploy log https://app.netlify.com/sites/rslib/deploys/66eaba8e1e6e6e0008a6f6a3

@fi3ework fi3ework enabled auto-merge (squash) September 18, 2024 11:36
@fi3ework fi3ework merged commit f5cbb89 into main Sep 18, 2024
10 checks passed
@fi3ework fi3ework deleted the shim-importmetaurl branch September 18, 2024 11:37
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.

2 participants