File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,15 @@ const varName = pascalCase(packageName);
30
30
exec (
31
31
`rollup -c scripts/config.js -f umd -n ${ varName } -o umd/${ packageName } .js` ,
32
32
{
33
+ EXTERNALS : "peers" ,
33
34
BUILD_ENV : "development"
34
35
}
35
36
) ;
36
37
37
38
exec (
38
39
`rollup -c scripts/config.js -f umd -n ${ varName } -o umd/${ packageName } .min.js` ,
39
40
{
41
+ EXTERNALS : "peers" ,
40
42
BUILD_ENV : "production"
41
43
}
42
44
) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,16 @@ const commonjs = require("rollup-plugin-commonjs");
3
3
const replace = require ( "rollup-plugin-replace" ) ;
4
4
const resolve = require ( "rollup-plugin-node-resolve" ) ;
5
5
const uglify = require ( "rollup-plugin-uglify" ) ;
6
+ const pkg = require ( "../package.json" ) ;
7
+
8
+ const getExternals = externals => {
9
+ const deps = Object . keys ( pkg . dependencies || { } )
10
+ const peers = Object . keys ( pkg . peerDependencies || { } )
11
+
12
+ return externals === 'peers'
13
+ ? peers
14
+ : deps . concat ( peers )
15
+ }
6
16
7
17
const getPlugins = env => {
8
18
const plugins = [ resolve ( ) ] ;
@@ -45,7 +55,7 @@ const config = {
45
55
react : "React"
46
56
}
47
57
} ,
48
- external : [ "react" ] ,
58
+ external : getExternals ( process . env . EXTERNALS ) ,
49
59
plugins : getPlugins ( process . env . BUILD_ENV )
50
60
} ;
51
61
You can’t perform that action at this time.
0 commit comments