BeniaminoBaggins
BeniaminoBaggins

Reputation: 12433

react-native-init config files - unsure which ones to edit for absolute import paths

I want to start using absolute import paths in my app, by following this tutorial. I have all of the same files as the tutorial has, except for webpack.config.js. I created my app 2 years ago, I think with react-native init Vepo, and it set it all up for me. I never did many configurations as it was automatic. I don't see a webpack.config.js file in my app so I am wondering what is the equivalent file in my app, so that I can follow the tutorial and adjust it for my app? If my project doesn't use webpack then I should not even get eslint-import-resolver-webpack as it won't work.

I only have these config files:

enter image description here

And these folders:

enter image description here

What is my equivalent config file of webpack.config.js so that I can look at my options of adding absolute import paths to my project?

Upvotes: 0

Views: 47

Answers (1)

Deadmano
Deadmano

Reputation: 237

You could create a package.json file within the directory you wish to import from which contains:

{
   "name":"src"
}

src being the name of the specific folder. Then you can import x from 'src/x.js' as an example.

Source.

Upvotes: 1

Related Questions