@@ -27,30 +27,55 @@ export const createRollupConfig = (
27
27
} ,
28
28
} ) ,
29
29
]
30
- const config : RollupConfig = {
31
- input : [ 'src/index.tsx' ] ,
32
- experimentalCodeSplitting : true ,
33
- output : {
34
- dir : 'dist' ,
35
- format : 'es' ,
30
+ const config : RollupConfig [ ] = [
31
+ {
32
+ input : [ 'src/index.tsx' ] ,
33
+ experimentalCodeSplitting : true ,
34
+ output : {
35
+ dir : 'dist' ,
36
+ format : 'es' ,
37
+ } ,
38
+ plugins : [
39
+ postcss ( {
40
+ extract : 'dist/index.css' ,
41
+ minimize : true ,
42
+ modules : {
43
+ generateScopedName : development
44
+ ? '[local]-[hash:base64:4]'
45
+ : '[hash:base64:4]' ,
46
+ } ,
47
+ } ) ,
48
+ babel ( { babelrc : false , ...babelConfig } ) ,
49
+ nodeResolve ( {
50
+ jsnext : true ,
51
+ extensions : [ '.mjs' , '.js' , '.json' , '.ts' , '.tsx' , '.css' ] ,
52
+ } ) ,
53
+ htmlPlugin ( { routes, entryStyles : [ 'index.css' ] } ) ,
54
+ ] . concat ( development ? [ ] : prodPlugins ) ,
55
+ } ,
56
+ {
57
+ input : 'src/index.tsx' ,
58
+ output : {
59
+ file : 'dist/nomodule.js' ,
60
+ name : 'nomodule' ,
61
+ format : 'iife' ,
62
+ } ,
63
+ plugins : [
64
+ postcss ( {
65
+ extract : false ,
66
+ modules : {
67
+ generateScopedName : development
68
+ ? '[local]-[hash:base64:4]'
69
+ : '[hash:base64:4]' ,
70
+ } ,
71
+ } ) ,
72
+ babel ( { babelrc : false , ...babelConfig } ) ,
73
+ nodeResolve ( {
74
+ jsnext : true ,
75
+ extensions : [ '.mjs' , '.js' , '.json' , '.ts' , '.tsx' , '.css' ] ,
76
+ } ) ,
77
+ ] . concat ( development ? [ ] : prodPlugins ) ,
36
78
} ,
37
- plugins : [
38
- postcss ( {
39
- extract : 'dist/index.css' ,
40
- minimize : true ,
41
- modules : {
42
- generateScopedName : development
43
- ? '[local]-[hash:base64:4]'
44
- : '[hash:base64:4]' ,
45
- } ,
46
- } ) ,
47
- babel ( { babelrc : false , ...babelConfig } ) ,
48
- nodeResolve ( {
49
- jsnext : true ,
50
- extensions : [ '.mjs' , '.js' , '.json' , '.ts' , '.tsx' , '.css' ] ,
51
- } ) ,
52
- htmlPlugin ( { routes, entryStyles : [ 'index.css' ] } ) ,
53
- ] . concat ( development ? [ ] : prodPlugins ) ,
54
- }
79
+ ]
55
80
return config
56
81
}
0 commit comments