Angular-cli: ng build --no-aot --prod does not work in angular-cli 1.5

Created on 4 Nov 2017  路  4Comments  路  Source: angular/angular-cli

Problem.

袗fter the upgrade to angular-cli 1.5 does not work JIT-mode.
https://github.com/splincode/angular5-demo

AOT:

ng build --aot --prod
cd dist/
http-server
# open in browser http://127.0.0.1:8081

It's work

JIT:

ng build --no-aot --prod
cd dist/
http-server
# open in browser http://127.0.0.1:8081
main.c90f048daaa26da75376.bundle.js:1 Uncaught Error: Unexpected value 't' imported by the module 't'. Please add a @NgModule annotation.
    at p (main.c90f048daaa26da75376.bundle.js:1)
    at main.c90f048daaa26da75376.bundle.js:1
    at Array.forEach (<anonymous>)
    at t.getNgModuleMetadata (main.c90f048daaa26da75376.bundle.js:1)
    at t._loadModules (main.c90f048daaa26da75376.bundle.js:1)
    at t._compileModuleAndComponents (main.c90f048daaa26da75376.bundle.js:1)
    at t.compileModuleAsync (main.c90f048daaa26da75376.bundle.js:1)
    at t.compileModuleAsync (main.c90f048daaa26da75376.bundle.js:1)
    at t.LMZF.t.bootstrapModule (main.c90f048daaa26da75376.bundle.js:1)
    at Object.cDNt (main.c90f048daaa26da75376.bundle.js:1)

Versions.

Angular CLI: 1.5.0
Node: 9.0.0
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.32
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.0
typescript: 2.4.2
webpack: 3.8.1

What am I doing wrong?

1 (urgent) broken

Most helpful comment

The problem is buildOptimizer still enabled in JIT for --prod, try ng build --prod --aot=false --build-optimizer=false could solve it.

Likely to be a valid BUG in https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/models/webpack-config.ts#L124.

All 4 comments

The problem is buildOptimizer still enabled in JIT for --prod, try ng build --prod --aot=false --build-optimizer=false could solve it.

Likely to be a valid BUG in https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/models/webpack-config.ts#L124.

When i run "ng build" it successfully builds but when i tried to ng build --prod version it fails can any one help to solve this problem`

Module not found: Error: Can't resolve './.' Field 'browser' doesn't contain a valid alias configuration
after using description file
: H:\Projects\Ashhad\EventifySyncGitlab\Eventify\package.json (relative path: ./src/assets/css)` . @filipesilva @Brocco

1
2
3

I am facing the same issue as reported.
--build-optimizer=false helped, but it should be turned off by default when aot is set to false.
Thank you @trotyl

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IngvarKofoed picture IngvarKofoed  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

ericel picture ericel  路  3Comments