Skip to content

Support SVGR in vitePluginNextImage #54

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rickdunkin
Copy link

This PR updates the next/image plugin to cater for SVGR usage by returning early when encountering an SVG and either there's an SVGR plugin in the config or if the image source has a query value of react

Closes #48

@hikariNTU
Copy link

We are also facing the same issue but our query is a bit different, we have:

  • my-file.svg?icon as React Component
  • my-file.svg as Nextjs Image Source
  • my-file.svg?ms for material-symbols special treatments React Components

I am wondering if we can provide an excluded pattern to this addon and in the storybook framework we provide a new options:

const config: StorybookConfig = {
  framework: {
    name: '@storybook/nextjs-vite',
    options: {
      nextImageExclude: ["**/*.svg?icon", "**/*.svg?ms"],
    },
  },
}

And the framework should provide the exact same value to this addon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] next/image plugin does not work with vite-plugin-svgr
2 participants