Package Exports
- babel-plugin-remove-code
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (babel-plugin-remove-code) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
babel-plugin-remove-code
Remove any code from your project.
Supported removals
Example
Debugger
In
// Debugger...
debugger;Out
// Debugger...Var
In
const stripA = 'foo';
const keepA = 'foo';
let stripB;
let keepB;
stripB = 'foo';
stripB = {};
keepB = 'foo';
export const stripC = {};
export const keepC = {};
export { stripD };
export { keepD };
export default { stripA, keepA };
console.log(stripA);
console.log(keepA);
if (stripA === 'foo') {}
if (keepA === 'foo') {}
if (stripB === 'foo' && keepB === 'foo') {}
keepA = stripA;
keepB = stripB && keepB;Out
const keepA = 'foo';
let keepB;
keepB = 'foo';
export const keepC = {};
export { keepD };
export default { keepA };
console.log(keepA);
if (keepA === 'foo') {}
if (keepB === 'foo') {}
keepB = keepB;Export
In
export const stripA = {};
export const keepA = {};
export { stripB };
export { keepB };
export default { stripC, keepC };Out
export const keepA = {};
export { keepB };
export default { keepC };Import
In
import { fsA } from "stripA";
import { fkA } from "keepA";
import fsB from "stripB";
import fkB from "keepB";
import { fsCProxy as fsC } from "stripC";
import { fkCProxy as fkC } from "keepC";
import "stripD";
import "keepD";Out
import { fkA } from "keepA";
import fkB from "keepB";
import { fkCProxy as fkC } from "keepC";
import "keepD";Function
In
function stripA () {}
function keepA () {}
const keepB = function stripB () {};
stripA();
console.keepC('foo');
console.keepC.stripC('foo');
console.stripD('bar');
console.stripD.keepD('bar');Out
function keepA() {}
const keepB;
console.keepC('foo');
console.stripD.keepD('bar');Installation
npm install --save-dev babel-plugin-remove-codeUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": [
["remove-code", {
"debugger": true,
"var": ["stripA", "stripB", "stripC", "stripD"],
"export": ["stripA", "stripB", "stripC"],
"import": ["stripA", "stripB", "stripC", "stripD"],
"function": ["stripA", "stripB", "stripC", "stripD"]
}]
]
}