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'}
.
yarn add babel-plugin-modules-map --dev
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';
BSD 2 Clause