I am able to build my CRNA app just fine for android and iOS but I am getting this import error when building for web. I used absolute imports in the past for this project.
Perhaps I need to change the babel.config somehow? This is tough to research because some elements (e.g. Webpack) are completely hidden to me.
EDIT: Put some junk in my babel.config.js and realized that Expo wasn’t loading it. I fixed the issue by clearing the expo cache (shift-R) which appears to force Expo to reload the babel config. Afterwards I got a bunch of transform stderr errors the first time the javascript bundle was built, but now it’s working so I suppose it’s good.
I seem to have fixed the web issue, but can’t get my babel config to work. Just want to confirm that we should be using babel.config.js and not .babelrc, as it states in the babel-plugin-module-resolver github link that you added.
I copied the config as you stated, but am still getting an error: (note that my files are in src/src/
Unable to resolve "src/styles/RawTheme" from "src/src/App.tsx"
Sure you can use babel.config.js the two are mostly interchangeable see: Configure Babel · Babel.
I think you are close try checking where you place files and give the full extension eg: src/styles/RawTheme.js, then add extensions to your module_resolver config. here is my full babel.config.js (you probably dont need to set root: ['src']) like I do
I actually revisited this this morning, and after changing my babel.config.js & tsconfig.json I was able to get absolute imports working. I didn’t need to add file extensions in the imports or in babel.config.js (perhaps because I’m using Typescript?)
I do get a ton of build errors when building webpack (see below), but it doesn’t seem to affect the build so things seem to be working.
Could not resolve "/Users/Varun/Documents/workspace/clyme/src/src/styles/RawTheme" in file /Users/Varun/Documents/workspace/clyme/src/src/App.tsx.