bpr

babel-plugin-resolve-bower-module

A Babel plugin to resolve ES6 imports that reference Bower modules.

Showing:

Popularity

Downloads/wk

22

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

6

Size (min+gzip)

46.0KB

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Categories

Readme

babel-plugin-resolve-bower-module

Build Status

A Babel plugin to resolve ES6 imports that reference Bower modules.

Installation

npm install babel-plugin-resolve-bower-module --save-dev

In your .babelrc file add the plugin to the plugins array:

{
  "plugins": [
    "resolve-bower-module"
  ]
}

How it works

This plugin will look for import statements where the module-name matches a Bower module that is declared as a dependency or a devDependency of the project, e.g.

import foo from 'foo';

will be transformed to something like

import foo from '../../bower_components/foo/src/index';

Options

If the plugin isn't resolving paths correctly or if your bower.json or .bowerrc aren't in process.cwd() you can pass cwd as an option to the plugin, e.g. in .babelrc specify

{
  "plugins": [
    ["resolve-bower-module", { "cwd": ".." }]
  ]
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100