Unable to resolve module after update to SDK43

Hi,

After updating to Expo SDK 43 I’m unable to compile. I had updated SDK multiple times in the past with the exact same module reference and never encountered this problem. It seems to me like it’s somehow looking at the wrong path, any ideas?

Unable to resolve module …/…/…/shared/src/redux/modules/orientation from /[MY_PATH]/mobile/src/components/Orientation.js:

None of these files exist:

  • …/shared/src/redux/modules/orientation(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  • …/shared/src/redux/modules/orientation/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)

I have this configured in my “rn-cli.config.js”, for some reason it stopped working after the upgrade:

const path = require("path");

module.exports = {
    projectRoot: path.resolve(__dirname),
    watchFolders: [path.resolve(__dirname, "../shared")],
};

I’m experiencing the same issue. Unable to resolve module ...

I’ve checked it a thousand times and there is nothing wrong with the module, and it works fine in Expo Go.

It has to be some kind of compiler issue introduced in sdk43.

I’ve not played with this sort of thing before, but after looking around a bit I get the impression that rn-cli.config.js might be deprecated. I’m not sure, though, but maybe have a look at the following:

Also, a monorepo might do what you want as well, and SDK 43 supposedly works better with monorepos. (Another thing I have not tried.)

1 Like

Hi guys,

I noticed there was a change in SDK 40 (Expo SDK 40 is now available. Today we’re announcing our fourth and… | by Brent Vatne | Exposition, search for “sourceExts”). Apparently since SDK 43 it’s a breaking one. Just rename your rn-cli.config.js to metro.config.js as per Configuring Metro | Metro.

Notabene, SDK 40 docs don’t include the “packagerOpts” setting anymore.

2 Likes

Also: Customizing Metro - Expo Documentation

Worked! Thank you!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.