Skip to content

Commit

Permalink
Merge pull request #162 from graingert/configure-transform-runtime-fo…
Browse files Browse the repository at this point in the history
…r-dist

Configure transform-runtime for all builds
  • Loading branch information
deini authored Sep 6, 2017
2 parents cc341b9 + d687030 commit ca5dd3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
6 changes: 1 addition & 5 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
}
]
],
"plugins": "transform-runtime",
"env": {
"test": {
"presets": ["env"]
},
"production": {
"plugins": [
"transform-runtime"
]
}
}
}
17 changes: 7 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ 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 = {
entry: 'src/index.js',
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,
})
)
}

Expand Down

0 comments on commit ca5dd3e

Please sign in to comment.