Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 1.65 KB

File metadata and controls

69 lines (49 loc) · 1.65 KB

babel-plugin-transform-es2015-modules-strip

This project has a package hosted on the NPM repository. This project is licensed under the terms of the MIT license.

A Babel plugin that strips import and export statements from modules.

Installation

npm install --save-dev babel-plugin-transform-es2015-modules-strip

Example

The plugin takes this code:

import path from 'path';

console.log(path.sep);

export default 42;

And returns this code:

console.log(path.sep);

Usage

In the babel.config.json configuration file

{
  "presets": [
    ["@babel/env", {
      "modules": false
    }]
  ],
  "plugins": ["transform-es2015-modules-strip"]
}

With the Node API

require("@babel/core").transformSync("code", {
  presets: [
    ["@babel/env", {
      "modules": false
    }]
  ],
  plugins: ["transform-es2015-modules-strip"]
});

History

This plugin was used by Bootstrap between v4.0.0-beta (twbs/bootstrap#22045) and v4.1.2 (twbs/bootstrap#26767).

License

This project is licensed under the terms of the MIT license.