Skip to content

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

Merged
fi3ework merged 1 commit intomainfrom
shim-importmetaurl
Sep 18, 2024
Merged

feat: support import.meta.url shim for CJS#216
fi3ework merged 1 commit intomainfrom
shim-importmetaurl

Conversation

@fi3ework
Copy link
Copy Markdown
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).

@netlify
Copy link
Copy Markdown

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
@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