File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 66 "main" : " index.js" ,
77 "scripts" : {
88 "benchmark" : " node benchmark" ,
9- "build" : " npm run clean && npm run build:min && npm run build:unmin" ,
10- "build:min" : " cross-env NODE_ENV=production rollup --config --file dist/html-react-parser.min.js --sourcemap" ,
11- "build:unmin" : " cross-env NODE_ENV=development rollup --config --file dist/html-react-parser.js" ,
9+ "build" : " rollup --config" ,
1210 "clean" : " rimraf dist" ,
1311 "lint" : " eslint --ignore-path .gitignore --ignore-pattern /examples/ ." ,
1412 "lint:dts" : " dtslint ." ,
1513 "lint:fix" : " npm run lint -- --fix" ,
16- "prepublishOnly" : " npm run lint && npm run lint:dts && npm test && npm run build" ,
14+ "prepublishOnly" : " npm run lint && npm run lint:dts && npm test && npm run clean && npm run build" ,
1715 "release" : " standard-version --no-verify" ,
1816 "test" : " mocha" ,
1917 "test:coverage" : " nyc npm test" ,
4442 "@commitlint/config-conventional" : " ^8.3.4" ,
4543 "@types/react" : " ^16.9.35" ,
4644 "benchmark" : " ^2.1.4" ,
47- "cross-env" : " ^7.0.2" ,
4845 "dtslint" : " ^3.6.4" ,
4946 "eslint" : " ^7.1.0" ,
5047 "eslint-plugin-prettier" : " ^3.1.3" ,
5754 "react" : " ^16" ,
5855 "react-dom" : " ^16" ,
5956 "rimraf" : " ^3.0.2" ,
60- "rollup" : " ^1.26.3 " ,
57+ "rollup" : " ^1.32.1 " ,
6158 "rollup-plugin-commonjs" : " ^10.1.0" ,
6259 "rollup-plugin-node-resolve" : " ^5.2.0" ,
6360 "rollup-plugin-uglify" : " ^6.0.4" ,
Original file line number Diff line number Diff line change @@ -2,21 +2,25 @@ import commonjs from 'rollup-plugin-commonjs';
22import resolve from 'rollup-plugin-node-resolve' ;
33import { uglify } from 'rollup-plugin-uglify' ;
44
5- const config = {
5+ /**
6+ * Build rollup config for development (default) or production (minify = true).
7+ *
8+ * @param {Boolean } [minify=false]
9+ * @return {Object }
10+ */
11+ const getConfig = ( minify = false ) => ( {
612 external : [ 'react' ] ,
713 input : 'index.js' ,
814 output : {
15+ file : `dist/html-react-parser${ minify ? '.min' : '' } .js` ,
916 format : 'umd' ,
1017 globals : {
1118 react : 'React'
1219 } ,
13- name : 'HTMLReactParser'
20+ name : 'HTMLReactParser' ,
21+ sourcemap : true
1422 } ,
15- plugins : [ commonjs ( ) , resolve ( { browser : true } ) ]
16- } ;
23+ plugins : [ commonjs ( ) , resolve ( { browser : true } ) , minify && uglify ( ) ]
24+ } ) ;
1725
18- if ( process . env . NODE_ENV === 'production' ) {
19- config . plugins . push ( uglify ( ) ) ;
20- }
21-
22- export default config ;
26+ export default [ getConfig ( ) , getConfig ( true ) ] ;
You can’t perform that action at this time.
0 commit comments