question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng serve --aot is not running in 6.0.0-rc.5

See original GitHub issue

Versions

 _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 6.0.0-rc.5
Node: 9.3.0
OS: darwin x64
Angular: 6.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.5.7
@angular-devkit/build-angular      0.5.7
@angular-devkit/build-optimizer    0.5.7
@angular-devkit/core               0.5.7
@angular-devkit/schematics         0.5.7
@angular/cdk                       6.0.0-rc.12
@angular/language-service          5.2.10
@angular/material                  6.0.0-rc.12
@angular/material-moment-adapter   5.2.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0-rc.5
@schematics/angular                0.5.7
@schematics/update                 0.5.7
rxjs                               6.0.0-uncanny-rc.7
typescript                         2.7.2
webpack                            4.5.0

npm: 5.8.0
node: v9.3.0.

macOS (Sierra)

Repro steps

npm uninstall -g @angular/cli npm cache verify npm install -g @angular/cli@next

rm -rf node_modules dist npm install --save-dev @angular/cli@next npm install

Observed behavior

ng build --aot works fine, ng serve -- aot does not work,

> Unknown option: '--aot'


Desired behavior

I want to be able to run the following using npm start,

ng serve --aot --ssl --proxy-config proxy.config.json

My package.json,

{
  "name": "quickstart-angular5",
  "version": "5.0.5",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --prod --ssl --proxy-config proxy.config.json",
    "build": "run-s build:client build:aot build:server",
    "build:client": "ng build --prod --build-optimizer --app 0",
    "build:aot": "ng build --aot --app 1",
    "build:server": "webpack -p",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:free": "ngm build -p src/app/typescripts/free --clean && gulp npmFree && gulp startFree && gulp onlyFree",
    "build:pro": "ngm build -p src/app/typescripts/pro --clean && gulp only-pro && gulp startPro",
    "build:all": "npm run build:free && npm run build:pro",
    "aot:build": "ng build --prod --sm=false --aot=true --output-path=dist",
    "pre-commit": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.2",
    "@angular/animations": "^6.0.0-rc.0",
    "@angular/cdk": "^6.0.0-beta.5",
    "@angular/common": "^6.0.0-rc.0",
    "@angular/compiler": "^6.0.0-rc.0",
    "@angular/core": "^6.0.0-rc.0",
    "@angular/forms": "^6.0.0-rc.0",
    "@angular/http": "^6.0.0-rc.0",
    "@angular/material": "^6.0.0-beta.5",
    "@angular/material-moment-adapter": "^5.2.5",
    "@angular/platform-browser": "^6.0.0-rc.0",
    "@angular/platform-browser-dynamic": "^6.0.0-rc.0",
    "@angular/platform-server": "^5.2.10",
    "@angular/router": "^6.0.0-rc.0",
    "@auth0/angular-jwt": "^1.1.0",
    "@ng-bootstrap/ng-bootstrap": "1.0.0-beta.5",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^4.1.1",
    "@ngrx/entity": "^4.1.1",
    "@ngrx/router-store": "^4.1.1",
    "@ngrx/store": "^4.1.1",
    "@ngrx/store-devtools": "^4.1.1",
    "@swimlane/ngx-datatable": "^11.3.2",
    "@types/googlemaps": "^3.30.8",
    "angular-bootstrap-md": "^5.2.3",
    "angular2-cookie": "^1.2.6",
    "angular2-jwt": "^0.2.3",
    "angular2-uuid": "^1.1.1",
    "chart.js": "^2.7.2",
    "classlist.js": "1.1.x",
    "core-js": "^2.5.3",
    "del": "3.0.x",
    "easy-pie-chart": "^2.1.7",
    "effect": "^1.0.4",
    "eslint": "^4.19.1",
    "express": "^4.16.3",
    "font-awesome": "^4.7.0",
    "g": "^2.0.1",
    "gulp": "^3.9.1",
    "gulp-rename": "1.2.x",
    "gulp-run": "1.7.x",
    "hammerjs": "^2.0.8",
    "karma-jasmine": "^1.1.1",
    "moment": "^2.22.1",
    "ng-html-util": "1.0.x",
    "ng-http-loader": "^0.6.0",
    "ng-mdb-pro": "****************",
    "ngm-cli": "0.5.x",
    "ngrx-store-freeze": "^0.2.2",
    "ngrx-store-localstorage": "^0.2.4",
    "ngrx-store-logger": "^0.2.1",
    "npm": "^5.8.0",
    "raven-js": "^3.24.1",
    "reselect": "^3.0.1",
    "rxjs": "^6.0.0-beta.1",
    "rxjs-compat": "^6.0.0-uncanny-rc.7",
    "screenfull": "^3.3.2",
    "smoothscroll-polyfill": "0.3.x",
    "stacktrace-js": "^2.0.0",
    "systemjs": "^0.20.19",
    "web-animations-js": "2.3.x",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.5.0",
    "@angular/cli": "^6.0.0-rc.5",
    "@angular/common": "^5.2.6",
    "@angular/compiler-cli": "^6.0.0-rc.0",
    "@angular/core": "^5.2.6",
    "@angular/http": "^5.2.6",
    "@angular/language-service": "^5.2.10",
    "@compodoc/compodoc": "^1.1.2",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.103",
    "angular-router-loader": "^0.8.3",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "npm-run-all": "^4.1.2",
    "postcss-loader": "^2.1.3",
    "protractor": "~5.1.0",
    "ts-node": "~5.0.0",
    "tslint": "~5.9.1",
    "typescript": "^2.7.2",
    "webpack-cli": "^2.0.14",
    "webpack-node-externals": "^1.7.2"
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
noelmacecommented, Apr 19, 2018

I know that the --aot cli option was delete on serve, but @filipesilva should have a better answer for this.

But the dev-server architect support the aot option. It seems to be set to false by default, but I may be wrong here.

So you can activate aot for serve by setting your (angular.json).projects.[your project].architect.serve.options.aot to true.

      "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "poc:build",
            "aot": true
          },
          "configurations": {
            "production": {
              "browserTarget": "poc:build:production"
            }
          }
        },
1reaction
clydincommented, Apr 19, 2018

Duplicate of #10304. Resolved via angular/devkit#734

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 AOT compilation failed - typescript - Stack Overflow
However, if I now export the application using the following command ng build --prod --aot false the application works without any problem.
Read more >
angular/angular-cli - Gitter
after updating to Angular CLI: 6.0.0-rc.5, ng serve —aot is not working,,, I keep getting,,,, Unknown option: '—aot'. ng build —aot is ...
Read more >
What is AOT and JIT Compiler in Angular ? - GeeksforGeeks
What is AOT and JIT Compiler in Angular ? ; You can run your app in JIT with this command: ng build OR...
Read more >
Category: Angular CLI - Yakov Fain
When you run the ng serve command, the template compilation is performed inside the browser. After the browser loads your app bundles, the...
Read more >
angular routes not working in production - You.com
Routing in my app working perfectly in development mode, but when I serve my dist folder created by ng build --prod they don't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found