babel-plugin-import-alias-npm

A babel plugin that allows using aliases to reference npm files in ES2015 imports

Usage no npm install needed!

<script type="module">
  import babelPluginImportAliasNpm from 'https://cdn.skypack.dev/babel-plugin-import-alias-npm';
</script>

README

babel-plugin-import-alias-npm

A babel plugin that allows using aliases to reference npm files in ES2015 imports.

Requirements

This plugin assumes that NPM is being used with version >= 3.0.0. That's important because that's the first NPM version that uses flat dependencies, a feature that this plugin depends on.

Usage

This is a babel plugin that converts imports with sources starting with the npm: prefix to their path inside the node_modules folder. To use it, just add it to your package.json and pass it as a plugin when calling babel:

{
  "plugins": ["import-alias-npm"]
}