Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

angular.json server configurations should include optimization and sourceMap #672

Open
kmturley opened this issue Mar 22, 2019 · 0 comments

Comments

@kmturley
Copy link

Your angular.json is here:
https://github.com/angular/universal-starter/blob/master/angular.json

"server": {
  "builder": "@angular-devkit/build-angular:server",
  "options": {
    "outputPath": "dist/server",
    "main": "src/main.server.ts",
    "tsConfig": "src/tsconfig.server.json"
  },
  "configurations": {
    "production": {
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.prod.ts"
        }
      ]
    }
  }
}

I had to add "optimization" and "sourceMap" options myself to create a true production build:

"server": {
  "builder": "@angular-devkit/build-angular:server",
  "options": {
    "outputPath": "dist/server",
    "main": "src/main.server.ts",
    "tsConfig": "src/tsconfig.server.json"
  },
  "configurations": {
    "production": {
      "optimization": true,
      "sourceMap": false,
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.prod.ts"
        }
      ]
    }
  }
}

This removes the source maps and minifies the css

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant