1.0.0 • Published 7 years ago

babel-plugin-modules-map v1.0.0

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
7 years ago

babel-plugin-modules-map

Map configuration for modules, as a Babel plugin. Rewrites module specifiers to apply aliases.

For example, this code:

import mod from 'foo';

Will be transformed into:

import mod from 'bar';

When using the config: {foo: 'bar'}.

Install

yarn add babel-plugin-modules-map --dev

Usage

In your .babelrc add:

{
  "plugins": [
    ["modules-web-compat", {
      "foo": "bar"
    }]
  ]
}

The second argument being your map configuration. A map is like an alias from one name to another. Partial matches are also applied so that:

import mod from 'foo/baz';

With the config:

{
  "plugins": [
    ["modules-web-compat", {
      "foo": "bar"
    }]
  ]
}

Will become:

import mod from 'bar/baz';

License

BSD 2 Clause