Skip to content
Youngho Chaa cha cha
TwitterHomepage

Errors I encounter while working on a React Native app

react native, errors1 min read

This package itself specifies a main module field that could not be resolved

18/9/2023

I updated immer to 10.0.2 and then this started. It turns out immer uses main.js in the node_module and MetroJS bundler default doesn’t compile typescript .ts, .tsx, and .mjs file. Edit metro.config.js file in the root project folder to handle the file extension.

const { getDefaultConfig } = require('expo/metro-config');
let defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.sourceExts = [...defaultConfig.resolver.sourceExts, 'mjs']
module.exports = defaultConfig;
© 2024 by Youngho Chaa cha cha. All rights reserved.
Theme by LekoArts