-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
import.meta is empty #2249
Comments
You have to make the code work: fs.readFileSync(new URL('../package.json', import.meta.url)) In 2 ways,
Why is
|
Thanks for the comment. I agree that making Closing as "working as intended." |
Thank you so much for the detailed explanations! |
We should be able to bundle this when it's used in an isomorphic manner, this breaks bundling if any (non externalizeable) dependency includes isomorphic CJS/ESM compatible code of this type. |
I'm trying to use the gifsicle package in one of my projects, and have an import.meta.url issue. Here is a simple repo that reproduces the problem: https://github.com/davidmz/gifsicle-esbuild-test
Try to compile code with the
npm run build
command and then run it withnpm run run
. You will see theERR_INVALID_URL
error. This line of gifsicle code uses the import.meta.url:and esbuild compiled it to the:
What do I (or, maybe, the gifsicle authors) wrong?
The text was updated successfully, but these errors were encountered: