1+ import fs from 'fs' ;
12import { babel } from '@rollup/plugin-babel' ;
23import commonjs from '@rollup/plugin-commonjs' ;
4+ import json from '@rollup/plugin-json' ;
35import postcss from 'rollup-plugin-postcss' ;
46import replace from '@rollup/plugin-replace' ;
57import resolve from '@rollup/plugin-node-resolve' ;
@@ -14,7 +16,7 @@ import livereload from 'rollup-plugin-livereload';
1416const isDev = process . env . ROLLUP_WATCH === 'true' ;
1517
1618export default {
17- input : 'src/index-build.js' ,
19+ input : isDev ? 'src/index.js' : 'src/index-build.js' ,
1820 output : {
1921 name : 'waybackDiff' ,
2022 file : 'build/app.js' ,
@@ -38,19 +40,30 @@ export default {
3840 extensions : [ '.css' ] ,
3941 plugins : [ cssnano ( ) ]
4042 } ) ,
43+ json ( ) ,
4144 babel ( {
4245 babelrc : false ,
4346 exclude : 'node_modules/**' ,
4447 babelHelpers : 'bundled' ,
4548 presets : [ '@babel/preset-env' , '@babel/preset-react' ] ,
4649 plugins : [ '@babel/plugin-proposal-export-default-from' ]
4750 } ) ,
48- ! isDev && terser ( ) , // only minify in production
51+ terser ( ) ,
4952 isDev && serve ( {
5053 open : true ,
5154 contentBase : [ 'build' , 'public' ] ,
5255 host : '0.0.0.0' ,
53- port : 5000
56+ port : 5000 ,
57+ historyApiFallback : true ,
58+ //
59+ // To enable https you need:
60+ // mkdir cert
61+ // openssl req -x509 -newkey rsa:4096 -nodes -keyout cert/key.pem -out cert/cert.pem -days 36
62+ //
63+ // https: {
64+ // key: fs.readFileSync('cert/key.pem'),
65+ // cert: fs.readFileSync('cert/cert.pem')
66+ // }
5467 } ) ,
5568 isDev && livereload ( { watch : 'build' } )
5669 ] . filter ( Boolean )
0 commit comments