Skip to content

sebtrif/babel-plugin-symlink-import

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-symlink-import

Build Status

Import and compile local npm packages.

By default with babel-register and by convention with other Babel workflows, JavaScript files within node_modules will not be compiled, even if their containing directories are symlinks to directories outside of node_modules. This plugin aims to enable that usecase.

Installing

Install it locally to your project by running:

yarn add --dev babel-plugin-symlink-import

Add the plugin to your Babel configuration:

{
  "plugins": ["symlink-import"]
}

Usage

Given that your package.json contains:

{
  "name": "project",
  "dependencies": {
    "local-package": "v0.1.0"
  }
}

and you have a .myLinks file in the same folder as your package.json containing:

{
  "links": {
    "local-package": "link:./lib/local-package"
  } 
}

You can import files from the local library:

import localPackage from 'local-package'

and Babel will compile them instead of ignoring them because they are in the node_modules directory.

As a side-note, when you commit, you can ommit including the .myLinks file and everything will still work for your teammates.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%