From dcae2aae2849d846dc5c951754707df5298779d1 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 15 Jan 2023 17:28:12 +0100 Subject: [PATCH 1/3] feat(build): optimize build --- .woodpecker.yml | 2 ++ webpack.config.js | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/.woodpecker.yml b/.woodpecker.yml index 75d4c4c..afb2c9c 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -46,6 +46,8 @@ pipeline: node-build: image: node:16-slim + environment: + - CPU_COUNT=3 commands: - npm install -g svg2ttf ttf2eot ttf2woff2 - svg2ttf assets/fonts/deblan/src/deblan-icon.svg assets/fonts/deblan/deblan-icon.ttf diff --git a/webpack.config.js b/webpack.config.js index d485c49..8cb224a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,6 @@ const Encore = require('@symfony/webpack-encore'); +const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); +// const smp = new SpeedMeasurePlugin(); // Manually configure the runtime environment if not already configured yet by the "encore" command. // It's useful when you use tools that rely on webpack.config.js file. @@ -49,6 +51,10 @@ Encore config.plugins.push('@babel/plugin-proposal-class-properties'); }) + .configureTerserPlugin((config) => { + config.parallel = process.env.CPU_COUNT || true; + }) + // enables @babel/preset-env polyfills .configureBabelPresetEnv((config) => { config.useBuiltIns = 'usage'; From 3f51bdd362ab17c988d7c38cc1f3a3bbd3863ff6 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 15 Jan 2023 17:32:07 +0100 Subject: [PATCH 2/3] feat(build): optimize build --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 8cb224a..877f023 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,5 @@ const Encore = require('@symfony/webpack-encore'); -const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); +// const SpeedMeasurePlugin = require("speed-measure-webpack-plugin"); // const smp = new SpeedMeasurePlugin(); // Manually configure the runtime environment if not already configured yet by the "encore" command. From 8ee3cc8767fc7c7439872448114f48f0f0b0fd33 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 15 Jan 2023 17:37:26 +0100 Subject: [PATCH 3/3] feat(build): optimize build --- webpack.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 877f023..fac3947 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,8 @@ if (!Encore.isRuntimeEnvironmentConfigured()) { Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); } +const TERSER_PARALLEL = process.env.hasOwnProperty('CPU_COUNT') ? parseInt(process.env.CPU_COUNT) : true; + Encore // directory where compiled assets will be stored .setOutputPath('public/build/') @@ -52,7 +54,7 @@ Encore }) .configureTerserPlugin((config) => { - config.parallel = process.env.CPU_COUNT || true; + config.parallel = TERSER_PARALLEL; }) // enables @babel/preset-env polyfills