Socket
Socket
Sign inDemoInstall

absolute-imports

Package Overview
Dependencies
27
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    absolute-imports

Import project assets using absolute paths from the project root


Version published
Weekly downloads
21
decreased by-16%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

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"
  },
}

FAQs

Last updated on 03 Nov 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc