0.0.2 • Published 7 years ago

babel-plugin-import-helpers v0.0.2

Weekly downloads
2
License
MIT
Repository
-
Last release
7 years ago

babel-plugin-import-helpers

Babel plugin to map used babel helpers to module imports.

##How to install

npm i --save-dev babel-plugin-import-helpers

How to use

Add the plugin to the plugin section of your .babelrc file or relevant babel setting location.

{
    "presets": [ "es2015" ],
    "plugins": [ "import-helpers" ]
}

Options

Specify the import module using the module parameter, defaults to babel-helpers-module.

{
  "plugins": [
    ["import-helpers", { "module": "my-helper-module" }]
  ]
}

You may specify individual mappings using the map parameter. You can map to an export of the module specified in the module parameter using a string value, or provide a specific module if you specify an array value, with the first value being the module, the second being the export.

{
  "plugins": [
    ["import-helpers", {
        "module": "my-helper-module",
        "map": {
            "toArray": "arrayify",
            "createClass": ["class-util", "defineClass"]
        }
    }]
  ]
}

Helpers that used keywords or reserved words are prefixed with an underscore, typeof, instanceof and extends are renamed to _typeof, _instanceof and _extends.