From c7a2d199e358fd4b7e020899d7971e8dde7ea32e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Thu, 6 Aug 2020 23:08:28 +0200 Subject: [PATCH] Move exist check to the right place --- resources/serverless/code-web.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/resources/serverless/code-web.js b/resources/serverless/code-web.js index 305ebeca515..90d81b3fb9d 100644 --- a/resources/serverless/code-web.js +++ b/resources/serverless/code-web.js @@ -84,6 +84,17 @@ async function getBuiltInExtensionInfos() { allExtensions.push(ext); locations[ext.extensionPath] = path.join(BUILTIN_MARKETPLACE_EXTENSIONS_ROOT, ext.extensionPath); } + for (const ext of allExtensions) { + if (ext.packageJSON.browser) { + let mainFilePath = path.join(locations[ext.extensionPath], ext.packageJSON.browser); + if (path.extname(mainFilePath) !== '.js') { + mainFilePath += '.js'; + } + if (!await exists(mainFilePath)) { + fancyLog(`${ansiColors.red('Error')}: Could not find ${mainFilePath}. Use ${ansiColors.cyan('yarn watch-web')} to build the built-in extensions.`); + } + } + } return { extensions: allExtensions, locations }; } @@ -124,16 +135,6 @@ async function getExtensionPackageJSON(extensionPath) { return; // unsupported } - if (packageJSON.browser) { - let mainFilePath = path.join(extensionPath, packageJSON.browser); - if (path.extname(mainFilePath) !== '.js') { - mainFilePath += '.js'; - } - if (!await exists(mainFilePath)) { - fancyLog(`${ansiColors.yellow('Warning')}: Could not find ${mainFilePath}. Use ${ansiColors.cyan('yarn gulp watch-web')} to build the built-in extensions.`); - } - } - const packageNLSPath = path.join(extensionPath, 'package.nls.json'); const packageNLSExists = await exists(packageNLSPath); if (packageNLSExists) {