Description
Bug Report
- [ x] bug report
- [ ] feature request
I sometimes get this error at runtime while running ng build in watch mode (ng build -w).
When the error has occured it remains occurring on subsequent builds on file changes.
If I stop ng build and restart it, the error is gone (without modyfing any source code).
To be clear : ng build does succesfully build, I'm getting this error at runtime in the browser console window.
Versions.
@angular/cli: 1.4.2
node: 6.10.3
os: win32 x64
@angular/animations: 4.4.1
@angular/common: 4.4.1
@angular/compiler: 4.4.1
@angular/core: 4.4.1
@angular/forms: 4.4.1
@angular/http: 4.4.1
@angular/platform-browser: 4.4.1
@angular/platform-browser-dynamic: 4.4.1
@angular/router: 4.4.1
@angular/cli: 1.4.2
@angular/compiler-cli: 4.4.1
@angular/language-service: 4.4.1
typescript: 2.3.4
Repro steps.
ng build -w
It is not clear when this error occurs, so there are no clear steps to reproduce the error
The log given by the failure in de browser console:
compiler.es5.js:1694 Uncaught Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
at syntaxError (compiler.es5.js:1694)
at compiler.es5.js:15974
at Array.forEach ()
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getProvidersMetadata (compiler.es5.js:15959)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15614)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.loadModules (compiler.es5.js:26958)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAndComponents (compiler.es5.js:26931)
at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26860)
at PlatformRef.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef.bootstrapModuleWithZone (core.es5.js:4536)
at PlatformRef.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef.bootstrapModule (core.es5.js:4522)
syntaxError @ compiler.es5.js:1694
(anonymous) @ compiler.es5.js:15974
webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver._getProvidersMetadata @ compiler.es5.js:15959
webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata @ compiler.es5.js:15614
webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules @ compiler.es5.js:26958
webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAndComponents @ compiler.es5.js:26931
webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync @ compiler.es5.js:26860
webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef.bootstrapModuleWithZone @ core.es5.js:4536
webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef.bootstrapModule @ core.es5.js:4522
../../../../../src/main.ts @ main.ts:11
webpack_require @ bootstrap e8fa83c0e0879a93d2a6:54
0 @ main.ts:12
webpack_require @ bootstrap e8fa83c0e0879a93d2a6:54
webpackJsonpCallback @ bootstrap e8fa83c0e0879a93d2a6:25
(anonymous) @ main.bundle.js:1
Desired functionality.
The application should run if ng build encounters no errors.