Skip to content

ng build --no-aot --prod does not work in angular-cli 1.5 #8345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
splincode opened this issue Nov 4, 2017 · 4 comments · Fixed by #8346
Closed

ng build --no-aot --prod does not work in angular-cli 1.5 #8345

splincode opened this issue Nov 4, 2017 · 4 comments · Fixed by #8346
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity3: broken

Comments

@splincode
Copy link

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?

@trotyl
Copy link
Contributor

trotyl commented Nov 4, 2017

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.

@Brocco Brocco added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity3: broken labels Nov 13, 2017
@KhizerRehan
Copy link

KhizerRehan commented Nov 15, 2017

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

@tarasbobak
Copy link

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity3: broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants