Previously, we only handled Yarn and NPM lock files even though PNPM is supported as package manager.
The lock file is used to perform checks to determine if an initial execution of NGCC was already performed.
Closes#22632
BREAKING CHANGE:
`ivy` namespace has been removed from the public API.
- `ivy.AngularWebpackPlugin` -> `AngularWebpackPlugin`
- `ivy.AngularPluginOptions` -> `AngularPluginOptions`
With this change we reduce the redundant module rebuilds when Webpack's FS cache is restored.
Previously, when the cache was restored we caused all modules to be rebuild even though their contents didn't change. This is because the file emit history wasn't persisted to disk.
This also caused the side effect that Webpack will create additional cache `pack` files due to the unnecessary module rebuilds, which ultimatly causes increase of the size of the cache on disk.
Currently, when `analyzeAsync` promise is rejected, the build fails with an `UnhandledPromiseRejectionWarning`.
Example:
```
(node:69086) UnhandledPromiseRejectionWarning: Error: Cannot use a JavaScript or TypeScript file (/Users/error-testing/src/app/app.component.ts) in a component's styleUrls or templateUrl.
at WebpackResourceLoader._compile (/Users/error-testing/node_modules/@ngtools/webpack/src/resource_loader.js:107:19)
at WebpackResourceLoader.get (/Users/error-testing/node_modules/@ngtools/webpack/src/resource_loader.js:266:44)
at Object.resourceHost.readResource (/Users/error-testing/node_modules/@ngtools/webpack/src/ivy/host.js:48:35)
at AdapterResourceLoader.preload (file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:12177:31)
at resolveStyleUrl (file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:9593:36)
at file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:9621:47
at Array.map (<anonymous>)
at ComponentDecoratorHandler.preanalyze (file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:9621:29)
at TraitCompiler.analyzeClass (file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:6647:39)
at visit2 (file:///Users/error-testing/node_modules/@angular/compiler-cli/bundles/index.js:6494:14)
```
With this change we handle such error and also hide stacktraces
```
./src/app/app.module.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Cannot use a JavaScript or TypeScript file (/Users/error-testing/src/app/app.component.ts) in a component's styleUrls or templateUrl.
at /Users/error-testing/node_modules/@ngtools/webpack/src/ivy/loader.js:75:34
at processTicksAndRejections (internal/process/task_queues.js:95:5)
```
With this change we fix an issue in JIT mode were we try to access an inexistent `default` property of styles modules when emitted in CJS.
Also, we now emit templates modules without the default property when not targeting ES2015 or greater to normalize the how to `require` templates and styles.
Closes#21588