File tree Expand file tree Collapse file tree 1 file changed +33
-24
lines changed
Expand file tree Collapse file tree 1 file changed +33
-24
lines changed Original file line number Diff line number Diff line change @@ -9,41 +9,50 @@ import {
99 terser ,
1010} from 'rollup-plugin-terser' ;
1111
12- const config = {
13- input : 'src/index.js' ,
12+ const plugins = [
13+ globals ( ) ,
14+ builtins ( ) ,
15+ babel ( { exclude : 'node_modules/**' } ) ,
16+ localResolve ( ) ,
17+ resolve ( {
18+ module : true ,
19+ jsnext : true ,
20+ main : true ,
21+ preferBuiltins : true ,
22+ browser : true ,
23+ modulesOnly : true ,
24+ } ) ,
25+ terser ( ) ,
26+ commonjs ( ) ,
27+ filesize ( ) ,
28+ ] ;
29+
30+ const createConfig = filename => ( {
31+ input : `src/${ filename } .js` ,
1432 output : [
1533 {
16- file : ' build/index .js' ,
34+ file : ` build/${ filename } .js` ,
1735 format : 'umd' ,
1836 name : 'example-rollup-library' ,
1937 } ,
2038 {
21- file : ' build/index .cjs.js' ,
39+ file : ` build/${ filename } .cjs.js` ,
2240 format : 'cjs' ,
2341 name : 'example-rollup-library' ,
2442 } ,
2543 {
26- file : ' build/index .esm.js' ,
44+ file : ` build/${ filename } .esm.js` ,
2745 format : 'es' ,
2846 } ,
2947 ] ,
30- plugins : [
31- globals ( ) ,
32- builtins ( ) ,
33- babel ( { exclude : 'node_modules/**' } ) ,
34- localResolve ( ) ,
35- resolve ( {
36- module : true ,
37- jsnext : true ,
38- main : true ,
39- preferBuiltins : true ,
40- browser : true ,
41- modulesOnly : true ,
42- } ) ,
43- terser ( ) ,
44- commonjs ( ) ,
45- filesize ( ) ,
46- ] ,
47- } ;
48+ plugins,
49+ } ) ;
50+
51+ const configs = [
52+ 'index' ,
53+ 'a' ,
54+ 'b' ,
55+ 'c' ,
56+ ] . map ( filename => createConfig ( filename ) ) ;
4857
49- export default config ;
58+ export default configs ;
You can’t perform that action at this time.
0 commit comments