Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@ngtools/webpack): better AoTPlugin instance error
Currently, having multiple @ngtools/webpack installed yields a cryptic error in typescript: ``` ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined ``` This happens because a plugin is found, but it isn't an instance of the right class. This makes the loader assume it's being ran without a plugin (just transpiling TS). Then it tries to load a missing tsconfig and the error above is shown. This PR introduced better errors for both the wrong plugin instance and missing tsconfig. ``` ERROR in ./src/main.ts Module build failed: Error: AotPlugin was detected but it was an instance of the wrong class. This likely means you have several @ngtools/webpack packages installed.You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies. at Object.ngcLoader (D:\work\cli\packages\@ngtools\webpack\src\loader.ts:371:19) @ multi ./src/main.ts ``` ``` ERROR in ./src/main.ts Module build failed: Error: @ngtools/webpack is being used as a loader but no `tsConfigPath` option norAotPlugin was detected. You must provide at least one of these. at Object.ngcLoader (D:\work\cli\packages\@ngtools\webpack\src\loader.ts:442:19) @ multi ./src/main.ts ``` See #3781 (comment) and #3781 (comment) for context.
- Loading branch information