Configuring on babel.config.js?
See original GitHub issueI’m relatively new to Expo and React Native. Have been facing problems in using absolute paths while importing the modules. Was reading on how to implement this plugin but I am unable to use it properly since it has only instructions for .babelrc
. I did almost everything found on different threads regarding this but still, I am unable to use it properly. In my expo project, I also do not have any .babelrc
file instead I have babel.config.js
file.
I am trying to convert this code for .babelrc
:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": [
"transform-react-jsx-source",
["module-resolver", {
"root": ["./src"]
}]
]
}
}
}
To this for babel.config.js
:
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Configure Babel
Create a file called babel.config.json with the following content at the root of your project (where the package.json is). ... Check out the...
Read more >When to use babel.config.js and .babelrc - Stack Overflow
Also, some other times babel configuration files are downright ignored, as in the case of webpack and babel-loader. You'd expect babel to load ......
Read more >Advanced Features: Customizing Babel Config - Next.js
To start, you only need to define a .babelrc file (or babel.config.js ) at the top of your app. If such a file...
Read more >Adding custom babel configuration to your project - WPACK.IO
If you need shared babel config between @wpackio/scripts and some other tool, then create a babel.config.js file in the your project root. ......
Read more >How to Setup Babel in Node.js - freeCodeCamp
Let's setup a basic Node app which we will use for this tutorial. Create a new folder. For this tutorial, I'll call mine...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it’s important to reset cache after configuring new aliases just run
react-native start --resetCache
The new alias should take affect after that.@wlopz
It works for me in this way. Try it out.
That
~
is necessary. But when import modules, you don’t need that~
, and still useimport * from 'components'
.I haven’t studied the source code, I cannot give exact why…