mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-25 06:53:00 +00:00
build: Compress code in production environments
This commit is contained in:
parent
6f7e682927
commit
b9cbea5c96
1 changed files with 61 additions and 56 deletions
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue