diff --git a/.babelrc b/.babelrc index 7a375c0..d543970 100644 --- a/.babelrc +++ b/.babelrc @@ -7,14 +7,10 @@ } ] ], + "plugins": "transform-runtime", "env": { "test": { "presets": ["env"] - }, - "production": { - "plugins": [ - "transform-runtime" - ] } } } diff --git a/rollup.config.js b/rollup.config.js index 645a0fb..7dc80be 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,6 +3,7 @@ import commonjs from 'rollup-plugin-commonjs'; import nodeResolve from 'rollup-plugin-node-resolve'; import replace from 'rollup-plugin-replace'; import uglify from 'rollup-plugin-uglify'; +import { dependencies } from './package.json' const env = process.env.NODE_ENV; const config = { @@ -10,20 +11,16 @@ const config = { plugins: [], }; +const externals = Object.keys(dependencies).join('|'); + if (env === 'es' || env === 'cjs') { config.format = env; config.sourceMap = true; - config.external = [ - 'invariant', - 'lodash.curry', - 'lodash.isfunction', - 'lodash.isobject', - 'lodash.isplainobject', - 'lodash.map', - 'redux', - ]; + config.external = id => RegExp(`^(${externals})(\/.*)?$`).test(id); config.plugins.push( - babel() + babel({ + runtimeHelpers: true, + }) ) }