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

Wrong svgr config file resolution #379

Open
aspirisen opened this issue Aug 25, 2024 · 3 comments
Open

Wrong svgr config file resolution #379

aspirisen opened this issue Aug 25, 2024 · 3 comments

Comments

@aspirisen
Copy link

According to this line
const config = await resolveConfig(resolveConfigDir(filename));
https://github.com/kristerkari/react-native-svg-transformer/blob/master/index.js#L50

The svgr config will be searched starting from the svg file. If the svg file folder is not a child of current app folder the svgr config will be ignored.

In this case if you have .svgrrc.js file next to metro.config.js file the svgr config file will not be found.

@kristerkari
Copy link
Owner

Thanks @aspirisen !

Having the svg images inside the same folder as the React Native app itself is expected by default since it should work for most of the people using this library.

Do you have some example of your folder structure that you could share, or perhaps even a some kind of demo app that could demonstrate the problem?

All my own apps just contain the app code inside the same folder, so I haven't been thinking too much about how the library could work in a monorepo or a similar setup.

@aspirisen
Copy link
Author

@kristerkari Here is rough workspaces example
I would expect that packages/app/svgr.config.js will be taken as svgr configuration (like babel.config.js)
If you rename __svgr.config.js to svgr.config.js you will see logs in console
react-native-svg.zip

P.S. I faced realy strange issue when svgr.config.js is stuck somewhere in cache, it loads only once. I was able to invalidate cache by renaming the project folder

2024-09-11.22.29.30.mov

@kristerkari
Copy link
Owner

@aspirisen thanks for the example! I can have a look.

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

No branches or pull requests

2 participants