-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Compiler error when referencing import.meta.url in svelte scripts #4379
Comments
As far as I can tell |
Ahh that makes sense... i noticed it was only stage 3. Probably not worth it. I have a few alternative ideas i can try that don't require Feel free to close! |
I just got my proof of concept working, so I'll define my use case a bit further here. Since I filed this issue, I tried hard coding the filename just to make my poc work. This is the api that I could expose for the first version of my ssg. <script>
import { hydratable } from '/HydratableTree';
</script>
<!-- typing the path and filename is tedious and error prone -->
<div use:hydratable={['/components/this-components-filename.js', $$props]}>
some component
</div> However, if <script>
import { hydratable } from '/HydratableTree';
</script>
<div use:hydratable={[import.meta.url, $$props]}>
some component
</div> Anyway, I might need to explore writing a babel plugin if If you'd like me to look into a fix for allowing |
I figured out a hacky alternative to Since i'm using this inside headless chrome and not in production, my solution is good enough for me and you can feel free to close this issue. |
Acorn was supported |
In case anyone else gets here from Snowpack, you can work around this limitation by importing your env variables directly from URL (instead of via the
|
This is supported now in 3.24.0. |
Describe the bug
When trying to reference
import.meta.url
in a svelte script, a compiler error is thrown.import.meta.url allows es modules to figure out what their filename/url is.
Logs
To Reproduce
Copy/paste this into the REPL and view the console log error.
Expected behavior
Compilation should leave
import.meta.*
alone :)Severity
This is blocking a proof of concept i'm developing for a svelte static site generator that eliminates static trees and only hydrates trees marked as dynamic (partial hydration).
The text was updated successfully, but these errors were encountered: