Angular-cli: (ng build --aot --prod / ng build --aot --prod --output-hashing=all) does not hash dist

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

Versions

<!--
Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
  Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
-->

Angular CLI: 1.5.0
Node: 8.1.2
OS: darwin x64
Angular: 5.0.5

@angular/cli: 1.5.0
@angular-devkit/build-optimizer: 0.0.34
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.39
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0
@schematics/angular: 0.1.9
typescript: 2.4.2
webpack: 3.8.1

Repro steps


Run the following:

  • ng new angular-project
  • cd angular-project
  • npm run build --prod --aot or npm run build --prod --aot --output-hashing=all
  • ls dist

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

The dist folder does have hashed webpack bundles or the asset file names.

output from my ls dist log:

favicon.ico     inline.bundle.js.map    polyfills.bundle.js styles.bundle.js.map
index.html      main.bundle.js      polyfills.bundle.js.map vendor.bundle.js
inline.bundle.js    main.bundle.js.map  styles.bundle.js    vendor.bundle.js.map

Also noted that the source maps still remained which is said to also be false in cli docs. (Although this is a separate issue).

Desired behavior


Creating a build using --prod --aot should output hashed files as it says the --output-hashing is set to all with prod set in the cli documentation.

The motive for hashed files in the dist folder so that the user's browser doesn't retain an old catche of the website.

e.g .
main.bundle.js -> main.c23a355da45b462d10b8.bundle.js

Mention any other details that might be useful (optional)

Most helpful comment

To pass parameters through npm run, an -- needs to be added to the command line:

npm run build -- --prod

All 4 comments

To pass parameters through npm run, an -- needs to be added to the command line:

npm run build -- --prod

Thanks!

Thanks !!!

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