With this change we remove the usage of hard coded `src` directory and instead infer this from the `sourceRoot` project option.
We also remove the `angularCompilerOptions.entryModule` property in the server tsconfig as this is no longer needed with Ivy.
Closes#12104
Code related to decoding buffers into strings and parsing content into JSON can now be removed by using the
support provided directly from the Tree instance for the executing schematic.
By using the `strings` re-export from `@angular-devkit/schematics` instead of from `@angular-devkit/core`,
the number of imports from `@angular-devkit/core` has been reduced and lowers the direct dependency count
for many of the individual schematics.
With this change we update the universal schematic bootstrap code to handle HMR properly. Previously, the bootstrapping code was called only on `DOMContentLoaded` which is not triggered when running in HMR.
Closes#21932
The `inlineStyleLanguage` option should be set for an application's server target if also present in the application's build target. The setting is needed to ensure the server target properly builds the applica
tion's styles.
With this change we do several changes to the `angular.json` configuration for `build` , `server` and `app-shell` targets so that these are `production` by default.
- build, server and app-shell targets are configured to run production by default.
- We add a new configuration named `development` to run the mentioned builder targets in development. Ex: `ng build --configuration development`.
- When adding `universal` or `app-shell`, we generate the full set of configurations as per the `buiid` target. Previously, we only generated the `production` configuration.
- We added a helper script in `package.json` to run build in watch mode. `npm run watch` which is a shortcut for `ng build --watch --configuration development`
In case the browser builder hashes the assets we need to add this setting to the server builder as otherwise when assets it will be requested twice. One for the server which will be unhashed, and other on the client which will be hashed.
Closes#15953
Currently, in the CLI universal schematic we are setting the server output path to `dist/project-server` and not amending the build outputPath
Ex:
```
dist/project
dist/project-server
```
However, the above paths are being update when adding `nguniversal` to the below:
```
dist/project/browser
dist/project/server
```
With this change it is proposed to move that logic to upstream.
Related PR to clean up nguniversal schematics https://github.com/angular/universal/pull/1265
If i18n support is already present within an application, the newly generated `main.server.ts` file should also contain the `@angular/localize` polyfill to allow the universal application to function.
This universal schematic here, is the base for app-shell, @nguniversal/express-engine, and @nguniversal/hapi-engine
The optimizations are suggested to;
1) disables ngDevMode via terser
2) helps with cold server starts the same way as client by lowering JS parse times
When `newProjectRoot` the paths are prefixed with an `/` example `/project-name/tsconfig.lib.json` which results in these being marked as absolute paths, which causes build failures.
Fixes#14108
Currently when using `ivy-ngcc` it will print out a warning
```
Failed to read entry point info from //node_modules/@schematics/angular/workspace/files/package.json with error SyntaxError: Unexpected token < in JSON at position 1121.
```
Fixes#13378
- When using Universal sourceMaps should not be enabled or at least `styles` sourceMaps should be disabled as these will otherwise be inlined and will be set as apart of the server side rendered page.
- While there is no benefit to optimize the scripts at server level, styles should always be minified so that the server side rendered page is smaller.
Fixes#12541 and Fixes#12940