GithubHelp home page GithubHelp logo

Comments (9)

davidelanfranchi avatar davidelanfranchi commented on July 23, 2024 1

Hi @JonasKruckenberg ,
I created a reduced case and the metadata import worked perfectly.
I went back to my project and... It worked perfectly. ☺️

The issue is resolved.
Sorry for the misleading report, and thanks for your help!

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on July 23, 2024

What version of the plugin are you using? 3.1.0 or 3.4.0-next.3 ?
If you're not using 3.4.0-next.3 please check out the latest version from npm with npm install vite-imagetools@next and let me know if the issue is still present (Since @next is close to being released)

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on July 23, 2024

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 json.namedExports setting in your Vite-config (This option is true by default though)
In version 3.4.0-next.3 json.namedExports is still ignored, but considered a regression, so it will come back with 3.4.0-next.4!

from imagetools.

davidelanfranchi avatar davidelanfranchi commented on July 23, 2024

Hi Jonas,
I was using version 3.1.0, indeed.
I tried to use the 3.4.0-next.4, but I receive another error, and I could not test it.

failed to load config from /Users/davide/Documents/Code/svelte-vite/vite.config.js error when starting dev server: TypeError: (0 , import_vite_imagetools.imagetools) is not a function

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on July 23, 2024

Alright, after fighting the monorepo build setup for the weekend, I got a new version released 3.4.0-next.5 that should hopefully address this issue! Can you confirm the problem is gone @davidelanfranchi?

from imagetools.

davidelanfranchi avatar davidelanfranchi commented on July 23, 2024

Hi @JonasKruckenberg,
I just tried (3.4.0-next.7) and the destructured import works, but I had to explicitly set Vite json.namedExports setting as true.
OIn the contrary, I receive the same error, The requested module [...] does not provide an export named [...].

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on July 23, 2024

I just tried (3.4.0-next.7) and the destructured import works, but I had to explicitly set Vite json.namedExports setting as true.

This is weird, this should not be necessary since the json.namedExports options is true by default. https://vitejs.dev/config/#json-namedexports

OIn the contrary, I receive the same error, The requested module [...] does not provide an export named [...].
What import are we talking about? Importing the plugin in you config object or importing an image with metadata?

from imagetools.

davidelanfranchi avatar davidelanfranchi commented on July 23, 2024

I'm talking about the image with metadata (&meta directive).
I tried to set json.namedExports, although the default is true, because of your first answer, and it worked.

from imagetools.

JonasKruckenberg avatar JonasKruckenberg commented on July 23, 2024

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?

from imagetools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.