File tree Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Expand file tree Collapse file tree 2 files changed +42
-3
lines changed Original file line number Diff line number Diff line change 5
5
"description" : " React-pdf helper functions" ,
6
6
"author" :
" Diego Muracciole <[email protected] >" ,
7
7
"homepage" : " https://github.com/diegomura/react-pdf#readme" ,
8
- "main" : " lib/index.js" ,
8
+ "main" : " lib/index.cjs.js" ,
9
+ "module" : " lib/index.es.js" ,
9
10
"repository" : {
10
11
"type" : " git" ,
11
12
"url" : " https://github.com/diegomura/react-pdf.git" ,
12
13
"directory" : " packages/fns"
13
14
},
14
15
"scripts" : {
15
16
"test" : " jest" ,
16
- "build" : " rimraf ./lib && babel src --out-dir lib " ,
17
- "watch" : " rimraf ./lib && babel src --out-dir lib --watch "
17
+ "build" : " rimraf ./lib && rollup -c " ,
18
+ "watch" : " rimraf ./lib && rollup -c -w "
18
19
},
19
20
"files" : [
20
21
" lib"
Original file line number Diff line number Diff line change
1
+ import babel from '@rollup/plugin-babel' ;
2
+ import pkg from './package.json' ;
3
+
4
+ const cjs = {
5
+ exports : 'named' ,
6
+ format : 'cjs' ,
7
+ } ;
8
+
9
+ const esm = {
10
+ format : 'es' ,
11
+ } ;
12
+
13
+ const getCJS = override => Object . assign ( { } , cjs , override ) ;
14
+ const getESM = override => Object . assign ( { } , esm , override ) ;
15
+
16
+ const input = 'src/index.js' ;
17
+
18
+ const getExternal = ( ) => [ / @ b a b e l \/ r u n t i m e / ] ;
19
+
20
+ const getPlugins = ( ) => [
21
+ babel ( {
22
+ babelrc : true ,
23
+ babelHelpers : 'runtime' ,
24
+ exclude : 'node_modules/**' ,
25
+ } ) ,
26
+ ] ;
27
+
28
+ const config = {
29
+ input,
30
+ output : [
31
+ getESM ( { file : 'lib/index.es.js' } ) ,
32
+ getCJS ( { file : 'lib/index.cjs.js' } ) ,
33
+ ] ,
34
+ external : getExternal ( ) ,
35
+ plugins : getPlugins ( ) ,
36
+ } ;
37
+
38
+ export default config ;
You can’t perform that action at this time.
0 commit comments