I am using React Native EXPO.
I am encountering the following error and need help to resolve it:
iOS Bundling failed 14746ms (index.js) Unable to resolve "make-plural" from "node_modules/i18n-js/dist/require/Pluralization.js"
I followed the Expo documentation to install expo-localization and i18n-js, and imported them in my App.js as follows:
import * as Localization from 'expo-localization';
import I18n from 'i18n-js';
However, I am still getting the above error during the build process.
metro.config.js
add ‘mjs’ to sourceExts.
const { getDefaultConfig } = require('@expo/metro-config')
const path = require('path')
const exclusionList = require('metro-config/src/defaults/exclusionList')
const extraNodeModules = {
shared: path.resolve(__dirname + '/../shared')
}
const watchFolders = [
path.resolve(__dirname + '/../shared')
]
const defaultConfig = getDefaultConfig(__dirname)
const config = {
...defaultConfig,
transformer: {
...defaultConfig.transformer,
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
})
},
resolver: {
...defaultConfig.resolver,
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'cjs', 'json', 'mjs'],
blockList: exclusionList([/#current-cloud-backend/.*/]),
extraNodeModules
},
watchFolders
}
module.exports = config