My babel module resolver is not working with React-Native (neither does intellij in VScode)
Here, Is my babel config
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./'],
alias: {
'@assets': './src/assets',
'@modules': './src/modules',
'@config': './src/config',
'@utils': './src/utils',
},
},
],
],
};
And jsconfig.json
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@assets": ["./assets"],
"@modules": ["./modules"],
"@config": ["./config"],
"@utils": ["./utils"]
}
}
}
I changed import for one of my files and this is the error I get when I executed the build command from Xcode
Error: Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. Unable to resolve module
../../modules/store/components/Filtersfromsrc/utils/Router.js:None of these files exist:
Where I imported the file like this
import Filters from '@modules/store/components/Filters';
Try resetting the cache, if above suggested answers don't work
react-native start --reset-cache
This worked for me. For more info see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With