File tree 2 files changed +16
-15
lines changed
2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change 6
6
"main" : " index.js" ,
7
7
"scripts" : {
8
8
"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" ,
12
10
"clean" : " rimraf dist" ,
13
11
"lint" : " eslint --ignore-path .gitignore --ignore-pattern /examples/ ." ,
14
12
"lint:dts" : " dtslint ." ,
15
13
"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" ,
17
15
"release" : " standard-version --no-verify" ,
18
16
"test" : " mocha" ,
19
17
"test:coverage" : " nyc npm test" ,
44
42
"@commitlint/config-conventional" : " ^8.3.4" ,
45
43
"@types/react" : " ^16.9.35" ,
46
44
"benchmark" : " ^2.1.4" ,
47
- "cross-env" : " ^7.0.2" ,
48
45
"dtslint" : " ^3.6.4" ,
49
46
"eslint" : " ^7.1.0" ,
50
47
"eslint-plugin-prettier" : " ^3.1.3" ,
57
54
"react" : " ^16" ,
58
55
"react-dom" : " ^16" ,
59
56
"rimraf" : " ^3.0.2" ,
60
- "rollup" : " ^1.26.3 " ,
57
+ "rollup" : " ^1.32.1 " ,
61
58
"rollup-plugin-commonjs" : " ^10.1.0" ,
62
59
"rollup-plugin-node-resolve" : " ^5.2.0" ,
63
60
"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';
2
2
import resolve from 'rollup-plugin-node-resolve' ;
3
3
import { uglify } from 'rollup-plugin-uglify' ;
4
4
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 ) => ( {
6
12
external : [ 'react' ] ,
7
13
input : 'index.js' ,
8
14
output : {
15
+ file : `dist/html-react-parser${ minify ? '.min' : '' } .js` ,
9
16
format : 'umd' ,
10
17
globals : {
11
18
react : 'React'
12
19
} ,
13
- name : 'HTMLReactParser'
20
+ name : 'HTMLReactParser' ,
21
+ sourcemap : true
14
22
} ,
15
- plugins : [ commonjs ( ) , resolve ( { browser : true } ) ]
16
- } ;
23
+ plugins : [ commonjs ( ) , resolve ( { browser : true } ) , minify && uglify ( ) ]
24
+ } ) ;
17
25
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