Skip to content

Commit d687030

Browse files
author
Thomas Grainger
committed
configure transform runtime for dist
1 parent cc341b9 commit d687030

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

.babelrc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,10 @@
77
}
88
]
99
],
10+
"plugins": "transform-runtime",
1011
"env": {
1112
"test": {
1213
"presets": ["env"]
13-
},
14-
"production": {
15-
"plugins": [
16-
"transform-runtime"
17-
]
1814
}
1915
}
2016
}

rollup.config.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,24 @@ import commonjs from 'rollup-plugin-commonjs';
33
import nodeResolve from 'rollup-plugin-node-resolve';
44
import replace from 'rollup-plugin-replace';
55
import uglify from 'rollup-plugin-uglify';
6+
import { dependencies } from './package.json'
67

78
const env = process.env.NODE_ENV;
89
const config = {
910
entry: 'src/index.js',
1011
plugins: [],
1112
};
1213

14+
const externals = Object.keys(dependencies).join('|');
15+
1316
if (env === 'es' || env === 'cjs') {
1417
config.format = env;
1518
config.sourceMap = true;
16-
config.external = [
17-
'invariant',
18-
'lodash.curry',
19-
'lodash.isfunction',
20-
'lodash.isobject',
21-
'lodash.isplainobject',
22-
'lodash.map',
23-
'redux',
24-
];
19+
config.external = id => RegExp(`^(${externals})(\/.*)?$`).test(id);
2520
config.plugins.push(
26-
babel()
21+
babel({
22+
runtimeHelpers: true,
23+
})
2724
)
2825
}
2926

0 commit comments

Comments
 (0)