Skip to content

Commit 6568e7e

Browse files
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.
1 parent 7faf9b9 commit 6568e7e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/controllers/update-controller.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ export class UpdateController extends UpdateControllerBase implements IUpdateCon
8787
this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.HOOKS_DIR_NAME));
8888
this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.PLATFORMS_DIR_NAME));
8989
this.$fs.deleteDirectory(path.join(projectData.projectDir, constants.NODE_MODULES_FOLDER_NAME));
90-
this.$fs.deleteFile(path.join(projectData.projectDir, constants.WEBPACK_CONFIG_NAME));
90+
if (projectData.projectType === constants.ProjectTypes.ReactFlavorName || projectData.projectType === constants.ProjectTypes.SvelteFlavorName) {
91+
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.`);
92+
} else {
93+
this.$fs.deleteFile(path.join(projectData.projectDir, constants.WEBPACK_CONFIG_NAME));
94+
}
9195
this.$fs.deleteFile(path.join(projectData.projectDir, constants.PACKAGE_LOCK_JSON_FILE_NAME));
9296
this.$logger.info("Clean old project artefacts complete.");
9397
}

0 commit comments

Comments
 (0)