Expose your source folder globally within your project.
This works by essentially creating a symlink of the
source directory you wish to expose under node_modules
.
Because require('../../../../../../../../../')
has to go.
npm install --save link-require
In your package.json:
{
"scripts": {
"postinstall": "link-require ./src:app"
}
}
You can specify multiple mapping as well:
{
"scripts": {
"postinstall": "link-require ./src:src ./lib:lib"
}
}
const mySource = require('app/mySource')