Skip to content
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

How I can use svgr with rollup with query parameters for import #808

Open
romanlex opened this issue Dec 9, 2022 · 2 comments
Open

How I can use svgr with rollup with query parameters for import #808

romanlex opened this issue Dec 9, 2022 · 2 comments
Labels

Comments

@romanlex
Copy link

romanlex commented Dec 9, 2022

Hello!
With webpack I can use imports for svg as https://react-svgr.com/docs/webpack/#use-svgr-and-asset-svg-in-the-same-project
How I can use query params for import with rollup for svg imports?

@allen79yu
Copy link

Just got this issue too.
I write a plugin to solve my problem rollup-plugin-resource-query.

import url from '@rollup/plugin-url'
import svgr from '@svgr/rollup'
import resourceQuery from 'rollup-plugin-resouce-query'

export default {
  plugins: [resourceQuery({ resourceQuery: 'url' }), url(), svgr()],
  input: 'src/main.js',
  output: {
    file: 'bundle.js',
    format: 'cjs',
  },
}

It solve issue in my project at least.
hope someone came across this post can benefit from it. 😄

@stale
Copy link

stale bot commented May 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants