From 6568e7eed5e7e1a11b71f95f26346a1a1eac6465 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Tue, 27 Aug 2019 14:05:48 +0300 Subject: [PATCH] fix: tns update will not modify webpack.config.js of React/Svelte projects As both React and Svelte projects have custom webpack.config.js files, when `tns update` replaces the `webpack.config.js` file, the project becomes unusable. We do not have default webpack.config.js files for these templates, so for the momennt skip the replacement of the file during `tns update` and print informational warning. --- lib/controllers/update-controller.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/controllers/update-controller.ts b/lib/controllers/update-controller.ts index a7045f1425..94d5d14677 100644 --- a/lib/controllers/update-controller.ts +++ b/lib/controllers/update-controller.ts @@ -87,7 +87,11 @@ export class UpdateController extends UpdateControllerBase implements IUpdateCon this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.HOOKS_DIR_NAME)); this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.PLATFORMS_DIR_NAME)); this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME)); - this.$fs.deleteFile(path.join(projectData.projectDir, constants.WEBPACK_CONFIG_NAME)); + if (projectData.projectType === constants.ProjectTypes.ReactFlavorName || projectData.projectType === constants.ProjectTypes.SvelteFlavorName) { + this.$logger.warn(`As this project is of type ${projectData.projectType}, CLI will not update its ${constants.WEBPACK_CONFIG_NAME} file. Consider updating it manually.`); + } else { + this.$fs.deleteFile(path.join(projectData.projectDir, constants.WEBPACK_CONFIG_NAME)); + } this.$fs.deleteFile(path.join(projectData.projectDir, constants.PACKAGE_LOCK_JSON_FILE_NAME)); this.$logger.info("Clean old project artefacts complete."); }