-
-
Notifications
You must be signed in to change notification settings - Fork 144
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
Astro compatibility pragma #169
Comments
@Enteleform you can add your plugin before the astro one, just go here and check the plugin You can also install the |
Okay I'll try that out. Thanks for the tip! |
Hey @Enteleform, did it work for you? |
@francoromanol Yes, I got it to work. It's been a while so I don't remember exactly what it took to get it working, but I ended up not having to use the plugin reordering approach from |
Issue
I've been using
unplugin-icons
&unplugin-auto-import
with Astro, and the combination has worked very well when using a single renderer.When enabling multiple renderers, Astro requires a pragma comment (
/** @jsxImportSource react */
) to process JSX/TSX files with the appropriate renderer. Since those comments don't exist in the virtual files generated byunplugin-icons
, the dev server crashes immediately with a notification of missing renderer pragmas.Is there a way to prepend these pragmas to the virtual file contents that are generated?
Additional Info
I've tried injecting them during the
transform
hook, but it seems that Astro has already consumed the virtual files at this point and the error is still thrown (even when using{enforce:"pre"}
). I had a similar issue with modifying.astro
files duringtransform
, and @jonathantneal helped me to resolve the issue by recommending that I perform the modifications duringload
instead.However, that approach doesn't seem to work in this case, because I can't use
fs.readFileSync
as I did for the non-virtual.astro
files. I searched a bit and it seems like this sort of thing might be handled in Rollup viathis.load(id)
, but it seems that Vite does not have this capability: vitejs/vite#6810The text was updated successfully, but these errors were encountered: