Skip to content

Commit c788503

Browse files
Andaristerikras
authored andcommitted
Keep imports to babel helpers (#8)
1 parent f048da3 commit c788503

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

rollup.config.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ import flow from 'rollup-plugin-flow'
44
import commonjs from 'rollup-plugin-commonjs'
55
import { uglify } from 'rollup-plugin-uglify'
66
import replace from 'rollup-plugin-replace'
7+
import pkg from './package.json'
8+
9+
const makeExternalPredicate = externalArr => {
10+
if (externalArr.length === 0) {
11+
return () => false
12+
}
13+
const pattern = new RegExp(`^(${externalArr.join('|')})($|/)`)
14+
return id => pattern.test(id)
15+
}
716

817
const minify = process.env.MINIFY
918
const format = process.env.FORMAT
@@ -47,7 +56,14 @@ export default {
4756
},
4857
output
4958
),
50-
external: ['react', 'prop-types', 'final-form', 'react-final-form'],
59+
external: makeExternalPredicate(
60+
umd
61+
? Object.keys(pkg.peerDependencies || {})
62+
: [
63+
...Object.keys(pkg.dependencies || {}),
64+
...Object.keys(pkg.peerDependencies || {})
65+
]
66+
),
5167
plugins: [
5268
resolve({ jsnext: true, main: true }),
5369
flow(),

0 commit comments

Comments
 (0)