nativescript-dev-webpack
nativescript-dev-webpack copied to clipboard
Executing the update script `update-ns-webpack` breaks the AoT compilation in code-sharing projects
Describe the bug
The newly generated code-sharing applications come with a custom tsconfig.tns.json configuration file. Executing the update script from nativescript-dev-webpack (npx update-ns-webpack --configs) overrides the existing tsconfig.tns.json file with the default configuration file - https://github.com/NativeScript/nativescript-dev-webpack/blob/master/templates/tsconfig.tns.json.
However, the AoT compilation in the code-sharing project doesn't work with the default tsconfig file.
To Reproduce
npm i -g @angular/cli @nativescript/schematics@next
ng new --collection=@nativescript/schematics my-shared-project --shared
cd my-shared-project
npx update-ns-webpack --configs
tns build --bundle --env.aot
Expected behavior Executing the update script for the webpack plugin shouldn't break the code-sharing project.
Suggested solutions
- Don't update the
tsconfig.tns.jsonfile at all. - In the update script, read the
tsconfig.tns.jsonfile and omit its update if its content matches exactly the content of a code-sharing config file. - Detect that the project is a code-sharing one and then - skip the update of the
tsconfig.tns.jsonfile. - Please comment with any suggestions you might have.