1- import babel from 'rollup-plugin-babel' ;
2- import json from 'rollup-plugin-json' ;
3- import nodeResolve from 'rollup-plugin-node-resolve' ;
4- import bundleSize from 'rollup-plugin-bundle-size' ;
5- import uglify from 'rollup-plugin-uglify' ;
6- import string from 'rollup-plugin-string' ;
1+ import babel from 'rollup-plugin-babel'
2+ import json from 'rollup-plugin-json'
3+ import nodeResolve from 'rollup-plugin-node-resolve'
4+ import bundleSize from 'rollup-plugin-bundle-size'
5+ import uglify from 'rollup-plugin-uglify'
6+ import string from 'rollup-plugin-string'
77import replace from 'rollup-plugin-replace'
88import ignore from 'rollup-plugin-ignore'
9- import pkg from './package.json' ;
9+ import pkg from './package.json'
1010
1111const cjs = {
1212 exports : 'named' ,
@@ -28,43 +28,42 @@ const configBase = {
2828 string ( { include : '**/*.afm' } ) ,
2929 babel ( {
3030 babelrc : false ,
31- presets : [ [ 'es2015' , { modules : false } ] ] ,
31+ presets : [
32+ [
33+ 'env' ,
34+ {
35+ modules : false ,
36+ targets : {
37+ ie : '11'
38+ }
39+ }
40+ ]
41+ ] ,
3242 plugins : [ 'external-helpers' ] ,
3343 runtimeHelpers : true
3444 } ) ,
35- bundleSize ( ) ,
45+ bundleSize ( )
3646 ] ,
3747 external : Object . keys ( pkg . dependencies )
3848}
3949
4050const serverConfig = Object . assign ( { } , configBase , {
41- output : [
42- getESM ( { file : 'dist/pdfkit.es.js' } ) ,
43- getCJS ( { file : 'dist/pdfkit.cjs.js' } ) ,
44- ] ,
51+ output : [ getESM ( { file : 'dist/pdfkit.es.js' } ) , getCJS ( { file : 'dist/pdfkit.cjs.js' } ) ] ,
4552 plugins : configBase . plugins . concat (
4653 replace ( {
47- BROWSER : JSON . stringify ( false ) ,
54+ BROWSER : JSON . stringify ( false )
4855 } )
4956 ) ,
5057 external : configBase . external . concat ( [ 'fs' ] )
5158} )
5259
5360const serverProdConfig = Object . assign ( { } , serverConfig , {
54- output : [
55- getESM ( { file : 'dist/pdfkit.es.min.js' } ) ,
56- getCJS ( { file : 'dist/pdfkit.cjs.min.js' } ) ,
57- ] ,
58- plugins : serverConfig . plugins . concat (
59- uglify ( )
60- ) ,
61+ output : [ getESM ( { file : 'dist/pdfkit.es.min.js' } ) , getCJS ( { file : 'dist/pdfkit.cjs.min.js' } ) ] ,
62+ plugins : serverConfig . plugins . concat ( uglify ( ) )
6163} )
6264
6365const browserConfig = Object . assign ( { } , configBase , {
64- output : [
65- getESM ( { file : 'dist/pdfkit.browser.es.js' } ) ,
66- getCJS ( { file : 'dist/pdfkit.browser.cjs.js' } ) ,
67- ] ,
66+ output : [ getESM ( { file : 'dist/pdfkit.browser.es.js' } ) , getCJS ( { file : 'dist/pdfkit.browser.cjs.js' } ) ] ,
6867 plugins : configBase . plugins . concat (
6968 replace ( {
7069 BROWSER : JSON . stringify ( true )
@@ -74,18 +73,8 @@ const browserConfig = Object.assign({}, configBase, {
7473} )
7574
7675const browserProdConfig = Object . assign ( { } , browserConfig , {
77- output : [
78- getESM ( { file : 'dist/pdfkit.browser.es.min.js' } ) ,
79- getCJS ( { file : 'dist/pdfkit.browser.cjs.min.js' } ) ,
80- ] ,
81- plugins : browserConfig . plugins . concat (
82- uglify ( )
83- ) ,
76+ output : [ getESM ( { file : 'dist/pdfkit.browser.es.min.js' } ) , getCJS ( { file : 'dist/pdfkit.browser.cjs.min.js' } ) ] ,
77+ plugins : browserConfig . plugins . concat ( uglify ( ) )
8478} )
8579
86- export default [
87- serverConfig ,
88- serverProdConfig ,
89- browserConfig ,
90- browserProdConfig
91- ]
80+ export default [ serverConfig , serverProdConfig , browserConfig , browserProdConfig ]
0 commit comments