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