angular-cli: Error when using exported interface
🐞 Bug report
Command (mark with an x
)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was: 8.0.3(See “anything else relevant” section, exact bug has appeared and been fixed before)
Description
A clear and concise description of the problem...Using an exported interface produces an error, app is not served.
🔬 Minimal Reproduction
export an interface:
export interface AppConfig {..}
export let APP_CONFIG = new InjectionToken<AppConfig>('app.config');
Import it elsewhere:
import { APP_CONFIG, AppConfig } from '../app.config';
Use it:
export class MyService {
constructor(@Inject(APP_CONFIG) config: AppConfig,...
...
}
🔥 Exception or Error
ng serve
ERROR in ./src/app/shared/my.service.ts 20:12-21
"export 'AppConfig' was not found in '../app.config'
App is not served. Havent tried build.
🌍 Your Environment
Angular CLI: 8.0.4
Node: 12.4.0
OS: win32 x64
Angular: 8.0.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.4
@angular-devkit/build-angular 0.800.4
@angular-devkit/build-optimizer 0.800.4
@angular-devkit/build-webpack 0.800.4
@angular-devkit/core 8.0.4
@angular-devkit/schematics 8.0.4
@angular/cli 8.0.4
@angular/pwa 0.800.4
@ngtools/webpack 8.0.4
@schematics/angular 8.0.4
@schematics/update 0.800.4
rxjs 6.5.2
typescript 3.4.5
webpack 4.30.0
Anything else relevant? Had this exact issue almost 3 years ago - https://github.com/angular/angular-cli/issues/2034#issuecomment-246009829. That issue has so many comments that I forget exactly how it was actually resolved, but it was, and warning eventually went away. Now its back. At that time it was a warning and was ignorable. This time its an error and app is not served…
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 31
- Comments: 18
Commits related to this issue
- workaround a bug in angular cli 8.0.4: https://github.com/angular/angular-cli/issues/14876 — committed to mseemann/angular2-mdl by mseemann 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to clydin/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to angular/angular-cli by clydin 5 years ago
- fix(@ngtools/webpack): skip non-runtime types when transforming constructors Fixes #14876 — committed to angular/angular-cli by clydin 5 years ago
- refactor: update to the latest @angular-devkit/build-angular The latest version now correctly imports interfaces, see https://github.com/angular/angular-cli/issues/14876 — committed to telerik/kendo-angular by tsvetomir 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-devextreme-demo by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-devextreme-starter by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-material-demo-architectui-admin-template by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-material-demo-coreui-admin-template by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-material-starter by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-nebular-demo by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-ng-bootstrap-demo by abadakhshan 5 years ago
- update to the latest @angular-devkit/build-angular https://github.com/angular/angular-cli/issues/14876 — committed to NarikMe/narik-primeng-demo by abadakhshan 5 years ago
- refactor: update to the latest @angular-devkit/build-angular The latest version now correctly imports interfaces, see https://github.com/angular/angular-cli/issues/14876 — committed to telerik/kendo-angular by tsvetomir 5 years ago
Same issue here. It seems that the issue was introduced with version 0.800.4 of the @angular-devkit/build-angular as already stated. If I explicitly install version 0.800.3 my application compiles with no error.
For everyone who needs a temporary solution
npm install @angular-devkit/build-angular@0.800.3
should fix the problem for now.It is not just exported interfaces, either. I think it has to do with the @Inject() decorator, because this code has the same problem, where the interface is local to the component.
Mela, I confirm this issue is fixed but now we are being hit by https://github.com/angular/angular-cli/issues/14888 ):
Same here. Explicitly installing
build-angular@0.800.3
and@angular-cli version 8.0.3
solves the problem.