Skip to content

Turning off AOT in angular.json for production does not work at runtime #11236

Closed
@jsgoupil

Description

@jsgoupil

I'm submitting a...

[X] Bug report

Current behavior

main.331a9edcffa8ca2717f0.js:1 Uncaught Error: Unexpected value 'e' imported by the module 'function(){}'. Please add a @NgModule annotation.
    at ka (main.331a9edcffa8ca2717f0.js:1)
    at main.331a9edcffa8ca2717f0.js:1
    at Array.forEach (<anonymous>)
    at e.getNgModuleMetadata (main.331a9edcffa8ca2717f0.js:1)
    at e._loadModules (main.331a9edcffa8ca2717f0.js:1)
    at e._compileModuleAndComponents (main.331a9edcffa8ca2717f0.js:1)
    at e.compileModuleAsync (main.331a9edcffa8ca2717f0.js:1)
    at e.compileModuleAsync (main.331a9edcffa8ca2717f0.js:1)
    at e.bootstrapModule (main.331a9edcffa8ca2717f0.js:1)
    at Object.zUnb (main.331a9edcffa8ca2717f0.js:1)

Expected behavior

It should work.

Minimal reproduction of the problem with instructions

ng new MyProject
cd MyProject
EDIT line "aot": true, replace by "aot": false
ng serve --configuration production

Navigate to http://localhost:4200/

What is the motivation / use case for changing the behavior?

Environment


Angular version: 6.0.3
Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions