6.1.1 • Published 7 years ago

babel6-plugin-remove-imports v6.1.1

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

Strip Filtered Imports

This plugin enables you to strip individual import declarations or specifiers when stripping code paths from a build.

For instance, you may use babel-plugin-filter-imports to remove some modules from a production build. This plugin will additionally filter a list of import declarations or specifiers that you wish to remove in conjunction with the above plugin.

API

"use strict";
// ...
const FilterImports = require('babel-plugin-filter-imports');
const StripFilteredImports = require('babel6-plugin-remove-imports');

const filteredImports = {
  'a-module-name': [
    'an-export',
    'another-export'
  ],
  'another-module-name': '*',
  'yet-another/module': true
};

// ...

new Babel('<some-path>', {
  plugins: [ 
    [FilterImports, filteredImports],
    [StripFilteredImports, filteredImports],
  ]
});