Skip to content

v1.5.1 AOT Build - Uncaught ReferenceError: InjectionToken is not defined #8518

Closed
@distributedlock

Description

@distributedlock

Versions

Angular CLI: 1.5.1
Node: 8.6.0
OS: win32 x64
Angular: 5.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

@angular/cli: 1.5.1
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.1
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1

Repro steps

  • ng serve --aot

Observed behavior

Uncaught ReferenceError: InjectionToken is not defined
    at eval (logger.service.ts:20)
    at Object.../../../../../src/app/shared/services/logger/logger.service.ts (main.bundle.js:206)
    at __webpack_require__ (inline.bundle.js:713)
    at fn (inline.bundle.js:118)
    at eval (logger.module.ts:2)
    at Object.../../../../../src/app/shared/services/logger/logger.module.ts (main.bundle.js:198)
    at __webpack_require__ (inline.bundle.js:713)
    at fn (inline.bundle.js:118)
    at eval (index.ts:1)
    at Object.../../../../../src/app/shared/services/index.ts (main.bundle.js:190)

Desired behavior

The app builds fine in AOT mode with no error, but when I run it in the browser, it results in the error provided above during bootstrap process. I tried to reproduce this error on CLI 1.5.0 and it works fine. It complains about InjectionToken being not defined.

Mention any other details that might be useful (optional)

Only happening on v1.5.1, works on v1.5.0. No other dependency was changed. All I did was upgrade @angular/cli from 1.5.0 to 1.5.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions