only extract langs from server when full build

This commit is contained in:
HF 2023-12-13 11:25:24 +01:00
parent 8d41c6533d
commit 9c5596d86a
2 changed files with 12 additions and 11 deletions

View File

@ -9,7 +9,7 @@
"main": "server.js",
"scripts": {
"build": "node scripts/build.js",
"build:server": "webpack --env extract --config ./webpack.config.server.js",
"build:server": "webpack --config ./webpack.config.server.js",
"build:client": "node scripts/build.js --client",
"build:dev": "webpack --config ./webpack.config.server.js && webpack --env development --config ./webpack.config.client.js && npm run minify-css",
"update-browserlist": "browserslist --update-db",

View File

@ -66,7 +66,10 @@ function buildServer() {
const ts = Date.now();
return new Promise((resolve, reject) => {
const serverCompile = spawn('npm', ['run', 'build:server']);
const argsc = (langs === 'all')
? ['webpack', '--env', 'extract', '--config', './webpack.config.server.js']
: ['webpack', '--config', './webpack.config.server.js']
const serverCompile = spawn('npx', argsc);
serverCompile.stdout.on('data', (data) => {
console.log(data.toString());
});
@ -163,7 +166,8 @@ async function buildProduction() {
promises.push(buildServer());
}
if (!recursion) {
if (doBuildClient) {
if (!recursion) {
console.log(
'Building one package seperately to populate cache and possibly extract langs...',
);
@ -175,16 +179,13 @@ async function buildProduction() {
clean: true,
readonly: false,
}));
}
if (!recursion) {
console.log('-----------------------------');
console.log(`Minify CSS assets...`);
console.log('-----------------------------');
await minifyCss();
}
console.log('-----------------------------');
console.log(`Minify CSS assets...`);
console.log('-----------------------------');
await minifyCss();
}
if (doBuildClient) {
if (parallel) {
promises.push(buildClientsParallel(avlangs));
} else {