-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(sandpack): Rewrite import.meta to $csb__import_meta #6031
Conversation
CSB-858 `import.meta` isn't currently polyfilled
We need to polyfill import.meta.url to get Framer's esmodules to work, this is also a great feature for us in general. These should be transpiled away to something like |
Build for latest commit 578c306 is at https://pr6031.build.csb.dev/s/new. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 578c306:
|
What kind of change does this PR introduce?
Before this PR we didn't touch import.meta which resulted in errors as
import.meta
is only allowed in ESModules.What is the current behavior?
We don't do anything with import.meta resulting in errors.
What is the new behavior?
Now sandpack replaces
import.meta
with$csb__import_meta
which we insert as a module-scoped variable ifimport.meta
is used.What steps did you take to test this? This is required before we can merge, make sure to test the flow you've updated.
Wrote some basic unit tests and tried out this failing sandbox https://codesandbox.io/s/quizzical-cerf-2ph7r?file=/src/index.tsx
Closes CSB-858