fix(docs-infra): consider all formats when compiling docs examples with ngcc (#33206)

Previously, when compiling the docs examples with `ngcc` (to run them in
Ivy mode), we would only consider the `es2015` property. However, some
packages (such as `angular-in-memory-web-api`) may not have that
property in their `package.json`. They might still be compilable by
`ngcc`, if they define other format properties (such as `module` or
`main`), but `ngcc` would still fail if it could not find any of the
_specified_ properties (here only `es2015`):

```
Error: Unable to process any formats for the following entry-points (tried es2015):
  - /.../node_modules/angular-in-memory-web-api
```

This commit fixes potential issues by considering all properties that
would be considered if `ngcc` was run implicitly by `@angular/cli` and
aligns the command with the one that will be generated for new apps:
https://github.com/angular/angular/blob/3e14c2d02/packages/core/schematics/migrations/postinstall-ngcc/index.ts#L22

PR Close #33206
This commit is contained in:
George Kalpakas 2019-10-16 23:07:01 +03:00 committed by Matias Niemelä
parent 0e260d2c3b
commit 16fe90d6ac

View File

@ -80,9 +80,7 @@ class ExampleBoilerPlate {
}
if (ivy) {
// We only need the "es2015" bundles as the CLI webpack build does not need
// any other formats for building and serving.
shelljs.exec(`yarn --cwd ${SHARED_PATH} ngcc --properties es2015`);
shelljs.exec(`yarn --cwd ${SHARED_PATH} ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points`);
}
exampleFolders.forEach(exampleFolder => {