[SOLVED] rn-cli-config.js not working after update to SDK 31


#1

I have this project structure for my native app and it was working in SDK 29

My rn-cli-config.js was resolving paths outside “native” directory and was providing node modules to this paths.

Now it is not resolving any paths and i assume my rn-cli-config.js not working at all.
rn-cli-config.js

const path = require('path');
const installedDependencies = require("./package.json").dependencies;

const extraNodeModules = {};

Object.keys(installedDependencies).forEach(dep => {
	extraNodeModules[dep] = path.resolve(__dirname, "node_modules", dep);
});
module.exports = {
	getProjectRoots() {
		return[
			path.resolve(__dirname),
			path.resolve(__dirname, '../requester'),
			path.resolve(__dirname, "../store"),
			path.resolve(__dirname, "../reducers"),
			path.resolve(__dirname, "../actions"),
			path.resolve(__dirname, "../hocs"),
            path.resolve(__dirname, "../middlewares"),
            path.resolve(__dirname, "../utils"),
        ]
	},
	extraNodeModules: extraNodeModules
};

Part of app.json for including rn-cli-config.js

  "packagerOpts": {
      "projectRoots": "",
      "config": "rn-cli.config.js"
    }

#2

I rolled back to SDK 29 and rn-cli.config.js is working. I think there is something in latest release of react-native. I was using https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz for SDK 31.


#3

Hey @digitaldali,

We mention this in the Breaking Changes section of the SDK31 release post. https://blog.expo.io/expo-sdk-v31-0-0-is-now-available-cad6d0463f49 As per the post, I’d recommend reading the source code of RN 0.57 to discern what changes to make with regards to your rn-cli.config.js.

Cheers,

Adam


#4

My bad, I will be reading Breaking Changes with more attention next time :persevere:
Thank you for pointing out!


closed #5

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