absolute-imports
v1.0.1
Published
Import project assets using absolute paths from the project root
Downloads
1,248
Readme
Absolute Imports
Import project assets using absolute paths from the project root.
So this…
const dateUtil = require('../../../utils/date')
…becomes…
const dateUtil = require('org-app/utils/date')
Support
Works with React Native and Node.
For web, you don't need this package. Simple add this to your Webpack config:
resolve: {
// ...
+ modulesDirectories: ['', 'node_modules'],
},
Install
yarn add absolute-imports
Setup
The best way to set up is to add the script to the postinstall
step - but feel free to move it around as you like.
// package.json
{
// ...
"scripts" {
// ...
"postinstall": "node absolute-imports --prefix=org --project=app"
},
}