-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Problem importing the metadata object #55
Comments
What version of the plugin are you using? 3.1.0 or 3.4.0-next.3 ? |
Because in version 3.1.0 the plugins usage of named exports (so that each property of the object also gets exported individually) is determined by the |
Makes #55 configurable by the user
Hi Jonas,
|
Alright, after fighting the monorepo build setup for the weekend, I got a new version released |
Hi @JonasKruckenberg, |
This is weird, this should not be necessary since the json.namedExports options is
|
I'm talking about the image with metadata ( |
Alright yeah, it should work without explicitly setting that option too. I tried the svelte starter app as well, but I cannot reproduce the missing named import warning. Can you maybe share a reproduction or a code snippet showing how you imported the image? |
Hi @JonasKruckenberg , The issue is resolved. |
Hi @JonasKruckenberg ,
I'm trying the plugin with a basic Vite + Svelte setup, scaffolded with @vite/create-app.
Thank you for your work, it's wonderful and it works well.
I encountered this issue using the metadata directive.
With this code:
import {src, width, height} from "$assets/images/usgs-AQ9-jKmebjM-unsplash.jpg?width=375&meta";
I get this error in console:
Uncaught SyntaxError: The requested module '/src/assets/images/usgs-AQ9-jKmebjM-unsplash.jpg?import&width=375&meta' does not provide an export named 'height'
Nonetheless, if I import as a single module the image:
import Meta from "$assets/images/usgs-AQ9-jKmebjM-unsplash.jpg?width=375&meta";
I get the correct metadata object.
//console.log(Meta);
{ "format": "jpeg", "width": 375, "height": 375, "channels": 3, "premultiplied": false, "size": 49715, "src": "node_modules/.cache/vite-imagetools/tmp/47fa4256/usgs-AQ9-jKmebjM-unsplash.jpeg" }
It's not a big deal, but it's something worth knowing, or maybe you have any hint about it.
I'm using the plugin with the force option as true, and the silent option as false.
✌️
The text was updated successfully, but these errors were encountered: