Browse Source

Enable minification and disable livereload on test env

mj-deploy
Standa Lukeš 4 years ago
parent
commit
dbf86e1617
  1. 11
      frontend/rollup.config.js

11
frontend/rollup.config.js

@ -7,6 +7,7 @@ import sveltePreprocess from 'svelte-preprocess';
import typescript from '@rollup/plugin-typescript'; import typescript from '@rollup/plugin-typescript';
const production = !process.env.ROLLUP_WATCH; const production = !process.env.ROLLUP_WATCH;
const halfProduction = production || !!process.env.HALF_PRODUCTION;
function serve() { function serve() {
let server; let server;
@ -42,7 +43,7 @@ export default {
svelte({ svelte({
// enable run-time checks when not in production // enable run-time checks when not in production
dev: !production, dev: !halfProduction,
// we'll extract any component CSS out into // we'll extract any component CSS out into
// a separate file - better for performance // a separate file - better for performance
css: css => { css: css => {
@ -62,8 +63,8 @@ export default {
}), }),
commonjs(), commonjs(),
typescript({ typescript({
sourceMap: !production, sourceMap: !halfProduction,
inlineSources: !production inlineSources: !halfProduction
}), }),
// In dev mode, call `npm run start` once // In dev mode, call `npm run start` once
@ -72,11 +73,11 @@ export default {
// Watch the `public` directory and refresh the // Watch the `public` directory and refresh the
// browser on changes when not in production // browser on changes when not in production
!production && livereload('public'), !halfProduction && livereload('public'),
// If we're building for production (npm run build // If we're building for production (npm run build
// instead of npm run dev), minify // instead of npm run dev), minify
production && terser() halfProduction && terser()
], ],
watch: { watch: {
clearScreen: false clearScreen: false