build: Compress code in production environments

This commit is contained in:
Starbeamrainbowlabs 2019-01-20 23:22:09 +00:00
parent 6f7e682927
commit b9cbea5c96
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -9,13 +9,7 @@ import { terser } from "rollup-plugin-terser";
import postcss_import from 'postcss-import'; import postcss_import from 'postcss-import';
import postcss_copy from 'postcss-copy'; import postcss_copy from 'postcss-copy';
export default { let plugins = [
input: 'client_src/js/index.mjs',
output: {
file: 'app/app.js',
format: 'esm'
},
plugins: [
resolve({ resolve({
// use "module" field for ES6 module if possible // use "module" field for ES6 module if possible
module: true, // Default: true module: true, // Default: true
@ -62,13 +56,24 @@ export default {
extract: true, extract: true,
sourceMap: true, sourceMap: true,
//minimize: true, // Causes an error at the moment for some reason //minimize: true, // Causes an error at the moment for some reason
}), })
];
// terser({ if(process.env.NODE_ENV == "production") {
// numWorkers: os.cpus().length, console.log("[config] In production environment - minifying JS");
// compress: { plugins.push(terser({
// ecma: 6 numWorkers: os.cpus().length,
// } compress: {
// }) ecma: 6
] }
}));
}
export default {
input: 'client_src/js/index.mjs',
output: {
file: 'app/app.js',
format: 'esm'
},
plugins
}; };