-
Notifications
You must be signed in to change notification settings - Fork 2
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 to make this work with cra app or with a .babelrc file? #4
Comments
So I got this to work with a .babelrc.js file and react-app-rewired.
It seems like for some reason it is unable to identify the jsx syntax. Any help here? |
I guess when you are using .babelrc.js, it's ignoring the CRA default babel config. Can you try adding on @babel/preset-react on .babelrc.js? |
Thanks @s-yadav for the quick response.
Also over here I see you are reading from the root path In my case my babelrc of dashboard-kit would be in the root and not inside src |
src is where my components lie which have not gone through babel . What I need is when I use any component from dashboard-kit I would want to see the components exported from inside of src which are es6, jsx code and babel to run on them like it does when we are developing something locally. The above seems to be not happening I hope I am able to explain my problem correctly |
If I remove the |
Your babel config looks correct. findRepoRootPath method finds the root path for aliased repo recursively going up to the folder tree until it find package.json. It treats the path where package.json is defined as rootPath. |
My bad I should have looked at the implementation of |
This works because it starts pointing to lib / dist files which are already transpiled. It should work with source file as well. If your babel is configured properly. |
Can we come over hangout now? It will be easier for me there to help. I feel its something to do with CRA, but I haven't tried it on CRA, so not sure about the exact problem |
sure that would be really helpful if we can connect over hangouts |
I was able to make it work on an ejected CRA app. Removing the s-yadav/number-format-app@6b97d58 Ejected Repo: |
@s-yadav Thanks for all your help in debugging this.
Please let me know if I can send a PR to update the README with the changes mentioned above for a non ejected CRA app. |
@vivek12345 Sorry I missed to see this earlier. Yes PR will be much appreciated. |
My application is a cra app and the packagebind README mostly mentions around using it with a babel.config.js file.
But most of the CRA apps add the babel config which is not visible unless you eject. The solution to that is using something like react-app-rewired but from what I have seen that too relies on a .babelrc file.
Do we have an easy way to make this work with CRA apps and with apps which are using .babelrc instead of babel.config.js
The text was updated successfully, but these errors were encountered: