How to Use Absolute Paths in React Native
David Woody
51815

You could use this https://www.npmjs.com/package/app-module-path

This simple module enables you to add additional directories to the Node.js module search path (for top-level app modules only). This allows application-level modules to be required as if they were installed into the node_modules directory.

1) Install

npm install app-module-path — save

2) In your app.js, before any require() calls:

require(‘app-module-path’).addPath(__dirname + ‘/app’);

3) In your very/far/away/module.js:

var Article = require(‘models/article’)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.