I was trying to load the API key from .env to my app.js in this way, iOS Bundling was completed, but Android Bundling failed. This is in an expo environment.
Here is the babel.config.js
:
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module:react-native-dotenv",
{
moduleName: "@env",
path: ".env",
},
],
],
};
};
And I imported in this way import {TEST_KEY} from '@env'
But I get iOS Bundling complete 39ms Android Bundling failed 27ms Unable to resolve "@env" from "App.js"