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", "main": "server.js",
"scripts": { "scripts": {
"build": "node scripts/build.js", "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: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", "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", "update-browserlist": "browserslist --update-db",

View File

@ -66,7 +66,10 @@ function buildServer() {
const ts = Date.now(); const ts = Date.now();
return new Promise((resolve, reject) => { 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) => { serverCompile.stdout.on('data', (data) => {
console.log(data.toString()); console.log(data.toString());
}); });
@ -163,7 +166,8 @@ async function buildProduction() {
promises.push(buildServer()); promises.push(buildServer());
} }
if (!recursion) { if (doBuildClient) {
if (!recursion) {
console.log( console.log(
'Building one package seperately to populate cache and possibly extract langs...', 'Building one package seperately to populate cache and possibly extract langs...',
); );
@ -175,16 +179,13 @@ async function buildProduction() {
clean: true, clean: true,
readonly: false, readonly: false,
})); }));
}
if (!recursion) { console.log('-----------------------------');
console.log('-----------------------------'); console.log(`Minify CSS assets...`);
console.log(`Minify CSS assets...`); console.log('-----------------------------');
console.log('-----------------------------'); await minifyCss();
await minifyCss(); }
}
if (doBuildClient) {
if (parallel) { if (parallel) {
promises.push(buildClientsParallel(avlangs)); promises.push(buildClientsParallel(avlangs));
} else { } else {