angular-cli: Error: Runtime compiler is not loaded

Bug Report or Feature Request (mark with an x)

  • bug report

Versions.

1.0.0-rc.2

Repro steps.

ng build -prod -e prod

The log given by the failure.

vendor.380a744….bundle.js:218 Error: Runtime compiler is not loaded
    at new Error (native)
    at Error.d (http://localhost:9000/portal/assets/dist/polyfills.a61f849adcea6ec74b69.bundle.js:36:1731)
    at r (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:1410:3338)
    at t.compileModuleAndAllComponentsAsync (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:1417:702)
    at e.ngOnChanges (http://localhost:9000/portal/assets/dist/main.f4b767a4fe115c7bb97e.bundle.js:1:1171229)
    at e.ngDoCheck (http://localhost:9000/portal/assets/dist/main.f4b767a4fe115c7bb97e.bundle.js:1:914180)
    at t.GGjx.t.detectChangesInternal (http://localhost:9000/portal/assets/dist/main.f4b767a4fe115c7bb97e.bundle.js:1:332790)
    at t.R2h3.t.detectChanges (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:653:5749)
    at t.Sqya.t.detectChangesInNestedViews (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:667:780)
    at t.GGjx.t.detectChangesInternal (http://localhost:9000/portal/assets/dist/main.f4b767a4fe115c7bb97e.bundle.js:1:329907)
    at t.R2h3.t.detectChanges (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:653:5749)
    at t.R2h3.t.internalDetectChanges (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:653:5542)
    at t.YSmj.t.detectChangesInternal (http://localhost:9000/portal/assets/dist/main.f4b767a4fe115c7bb97e.bundle.js:1:662563)
    at t.R2h3.t.detectChanges (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:653:5749)
    at t.Sqya.t.detectChangesInNestedViews (http://localhost:9000/portal/assets/dist/vendor.380a74466a8bf08fbdda.bundle.js:667:780)

Desired functionality.

App to run with no errors.

Mention any other details that might be useful.

I’ve taken a lot of time to make sure my app is matching packages and conventions of a fresh cli-rc2 app (ng new) with no luck yet.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 20 (4 by maintainers)

Most upvoted comments

I was facing the same Runtime compiler error in AOT production build. After a nice Saturday of rewriting project step by step I found that the problem was following module load:

export function loadGisModule() {
    return GisModule;
}

export const routes: Routes = [
    {
        path: '',
        component: OsksLayoutComponent,
        children: [
            {
                path: '',
                loadChildren: loadGisModule
            }
        ]
    }
];

@NgModule({
    imports: [
        RouterModule.forChild(routes)
    ],
    exports: [
        RouterModule
    ]
})
export class OsksLayoutRoutingModule { }

Changing module load to usual lazy load fixed the issue. loadChildren: '../../gis/gis.module#GisModule'

I feel a bit frustrated. The error message is very bizzare. But hey. Fixed. Hope it helps to anybody.

versions>
@angular/angular: 5.0.0
@angular/cli: 1.5.0
typescript: 2.6.1

@GeorgeKnap I have the same issue. My problem is that I precisely don’t want to lazy load. I wonder if I should open an issue about it.

versions:
angular 4.4.6
angular cli 1.4.9

@clydin yeah I just thought ng build -prod --prod made less sense. So it there a way to get content hashed file names without the AoT?

I’m trying ng build --prod -aot false but am getting this error in the browser:

polyfills.a61f849….bundle.js:36 Unhandled Promise rejection: Cannot read property 'features' of undefined ; Zone: angular ;

A production build uses AOT by default which does not use the runtime compiler. Also, the ‘-e prod’ is unnecessary when ‘–prod’ is used.