Skip to content

ReferenceError after update to 11.2.6 when using default exports #41377

@Eldelshell

Description

@Eldelshell

🐞 bug report

Affected Package

The issue is caused by package @angular/core and ng serve

Is this a regression?

Yes, the previous version in which this bug was not present was: 11.0.9

Description

After updating to 11.2.6 any Injectable which is modified while the ng serve is running, will throw an error.

A very simple example:


@Injectable({
    providedIn: 'root'
})
export default class ViewsCommonService {
  ...
}

🔥 Exception or Error


ReferenceError: ViewsCommonService is not defined
    at NodeInjectorFactory.AppComponent_Factory [as factory] (app.component.ts:5)
    at getNodeInjectable (core.js:3548)
    at instantiateRootComponent (core.js:10088)
    at createRootComponent (core.js:12395)
    at ComponentFactory$1.create (core.js:25038)
    at ApplicationRef.bootstrap (core.js:29451)
    at core.js:29164
    at Array.forEach ()
    at PlatformRef._moduleDoBootstrap (core.js:29164)
    at core.js:29134

🌍 Your Environment


Angular CLI: 11.2.6
Node: 15.11.0
OS: linux x64

Angular: 11.2.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.6
@angular-devkit/build-angular   0.1102.6
@angular-devkit/core            11.2.6
@angular-devkit/schematics      11.2.6
@angular/cli                    11.2.6
@schematics/angular             11.2.6
@schematics/update              0.1102.6
rxjs                            6.6.7
typescript                      4.0.7

Workaround

The only workaround is to restart ng serve

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerstate: has PR

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions