babel-plugin-inline-react-svg icon indicating copy to clipboard operation
babel-plugin-inline-react-svg copied to clipboard

Support React JSX automatic transform

Open macalinao opened this issue 3 years ago • 13 comments

The React JSX transform detects JSX by seeing if it's already in the file, but it won't know about transformed JSX if the node visitors were never hit.

https://github.com/babel/babel/blob/02fc9e835ceac71eb4de7dac6137fd0489176c29/packages/babel-helper-builder-react-jsx-experimental/src/index.js#L328

This new functionality can be enabled with noReactAutoImport: true in .babelrc.

Fixes https://github.com/airbnb/babel-plugin-inline-react-svg/issues/91.

macalinao avatar Dec 01 '20 05:12 macalinao

You can test this today using yarn add -D @simplyianm/babel-plugin-inline-react-svg.

macalinao avatar Dec 01 '20 05:12 macalinao

wow! this is so cool I need this.

bearcott avatar Dec 01 '20 19:12 bearcott

Hi! Can this update be reviewed? Sorry, that ask for it here. But it seems it is only pending for a reviewer for 2 weeks. I just don't understand it properly. But it seems that it would resolve the problem (https://github.com/airbnb/babel-plugin-inline-react-svg/issues/91), which I am having. Many thanks!

diegopelusa avatar Dec 23 '20 09:12 diegopelusa

@diegopelusa its been reviewed, and is waiting for a response from the PR author.

ljharb avatar Dec 23 '20 16:12 ljharb

Many thanks @ljharb !!! Let's hope that @macalinao sees these comments and respond to the review comments.

diegopelusa avatar Dec 28 '20 09:12 diegopelusa

Many thanks @ljharb !!! Let's hope that @macalinao sees these comments and respond to the review comments.

Hey sorry, I've been a bit busy recently, but if you want my changes you can install @simplyianm/babel-plugin-inline-react-svg.

macalinao avatar Dec 28 '20 20:12 macalinao

Many thanks @macalinao!!!! I would use your fork of the plugin, but I think the best way to get a stable product would be to merge into the one in airbnb. Hmm!! (If I could help you merge the changes, I would do it. But I have too little idea about all this software) Anyway, many thanks, and hopefully you get some time to close this PR.

diegopelusa avatar Dec 29 '20 08:12 diegopelusa

Any chance to merge this code? Only @macalinao can do it? I am currently avoiding to have React17 in my NextJS10 project, because there are errors with this plugin. Is there anything I can do, but just waiting? Or is now the fork @simplyianm/babel-plugin-inline-react-svg the one to be used for this plugin. Sorry, that I ask to impatiently. But I don´t know what to do next in this issue. Many thanks to everyone helping in this project!

diegopelusa avatar Jan 08 '21 10:01 diegopelusa

Any chance to merge this code? Only @macalinao can do it? I am currently avoiding to have React17 in my NextJS10 project, because there are errors with this plugin. Is there anything I can do, but just waiting? Or is now the fork @simplyianm/babel-plugin-inline-react-svg the one to be used for this plugin. Sorry, that I ask to impatiently. But I don´t know what to do next in this issue. Many thanks to everyone helping in this project!

You may upgrade to Next.js 10 and React 17 while using the classic React runtime via .babelrc:

{
	"presets": [["next/babel", { "preset-react": { "runtime": "classic" } }]],
	"plugins": ["babel-plugin-inline-react-svg"]
}

Please be patient towards the maintainers and the PR’s author, especially in the rough times we are living in nowadays.

kripod avatar Jan 08 '21 13:01 kripod

Hi @kripod ! Many thanks for the answer. I will try your proposed solution. I am sorry if anyone thinks I am impatient of pushing anyone to do something that is not appropriate in these days. I just wanted to know how to solve the current situation with the problem of React17, Next10 and this plugin. Sorry again if I asked in the wrong place or with bad words. That was not my intention!

diegopelusa avatar Jan 10 '21 10:01 diegopelusa

This is waiting on the OP to make the changes asked about here, or, for someone else to comment here (not a new PR, please) with a link to those updated changes, so i can pull them in to this PR.

ljharb avatar Jan 10 '21 14:01 ljharb

@macalinao Any chance you could follow this one up? Would love to see your work get merged. :)

robert-hurst-cmd avatar Jan 22 '21 06:01 robert-hurst-cmd

Sorry, it´s me again asking about news in this update. Any chance to finish the review and do the merge? It would be great to have it closed, after having identify the problem and propose a solution. Many thanks to anyone spending some time in this!

diegopelusa avatar Feb 16 '21 09:02 diegopelusa