File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 "description" : " React-pdf helper functions" ,
66 "author" : " Diego Muracciole <diegomuracciole@gmail.com>" ,
77 "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" ,
910 "repository" : {
1011 "type" : " git" ,
1112 "url" : " https://github.com/diegomura/react-pdf.git" ,
1213 "directory" : " packages/fns"
1314 },
1415 "scripts" : {
1516 "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 "
1819 },
1920 "files" : [
2021 " 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