UNPKG

@zohodesk/client_build_tool

Version:

A CLI tool to build web applications and client libraries

36 lines (28 loc) 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBabelPlugin = getBabelPlugin; var _modeUtils = require("../bundler/webpack/common/modeUtils"); var _addDefaultPlugins = require("./addDefaultPlugins"); const babelPluginMapping = { removeAttribute: './babel_plugins/removeAttributesPlugin', removePropTypes: 'babel-plugin-transform-react-remove-prop-types', devConsoleExclude: 'babel-plugin-transform-remove-console' }; const babelPluginOrder = ['removeAttribute', 'removePropTypes', 'devConsoleExclude']; function getBabelPlugin(options) { const { mode } = options; // let customPlugins = []; let customPlugins = []; const { babelCustomizations } = options; if ((0, _modeUtils.isProductionMode)(mode)) { const configCreator = _addDefaultPlugins.addDefaultPlugins; const plugins = babelPluginOrder.map(p => configCreator(babelCustomizations[p], babelPluginMapping[p])); customPlugins = plugins; } return customPlugins.filter(Boolean); }