From 8f6d1f7872aeb21392a89c1fe729f5524fa5e25c Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Tue, 14 Feb 2023 10:43:55 +0100 Subject: [PATCH] Fix webpack if no addons are present [SCI-7916] --- config/webpack/environment.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config/webpack/environment.js b/config/webpack/environment.js index d3a91f5fc..5aed01669 100644 --- a/config/webpack/environment.js +++ b/config/webpack/environment.js @@ -11,7 +11,16 @@ environment.loaders.prepend('vue', vue) // Engine pack loading based on https://github.com/rails/webpacker/issues/348#issuecomment-635480949 // Get paths to all engines' folders -const enginePaths = execSync('ls -d $PWD/addons/*').toString().split('\n').filter((p) => !!p); +console.log('Including packs from addons...'); + +let enginePaths = []; + +try { + enginePaths = execSync('ls -d $PWD/addons/*').toString().split('\n').filter((p) => !!p); +} catch { + console.log('Unable to find any addons.') +} + enginePaths.forEach((path) => { const packsFolderPath = `${path}/app/javascript/packs`;