Skip to content

Unreliable build hashes when running ng build --aot and after using ng eject #8640

@emilio-martinez

Description

@emilio-martinez

Versions

Angular CLI: 1.5.4 (e)
Node: 6.11.1
OS: darwin x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.4
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.4
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack-concat-plugin: 1.4.0
webpack-dev-server: 2.9.4
webpack: 3.8.1

Repro steps

The following are the exact commands I'm taking to reproduce. The items of note here are the "main" hashes (not the chunk or bundle hashes), which I'm marking with <===== to the right of each relevant hash.

➜  ng new testHash
...
➜  Desktop cd testHash
...
➜  testHash git:(master) ng build --prod
Date: 2017-11-26T08:56:50.130Z                                                          
Hash: 5a07dd3af5441b340e31 <=====
Time: 19908ms
chunk {0} polyfills.ad37cd45a71cb38eee76.bundle.js (polyfills) 60.8 kB [initial] [rendered]
chunk {1} main.ffbb21fa33d0e637d7cc.bundle.js (main) 152 kB [initial] [rendered]
chunk {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 0 bytes [initial] [rendered]
chunk {3} inline.723114ead04c6055da6b.bundle.js (inline) 1.45 kB [entry] [rendered]
➜  testHash git:(master) ng build --prod
Date: 2017-11-26T08:57:14.938Z                                                          
Hash: 5a07dd3af5441b340e31 <=====
Time: 19708ms
chunk {0} polyfills.ad37cd45a71cb38eee76.bundle.js (polyfills) 60.8 kB [initial] [rendered]
chunk {1} main.ffbb21fa33d0e637d7cc.bundle.js (main) 152 kB [initial] [rendered]
chunk {2} styles.d41d8cd98f00b204e980.bundle.css (styles) 0 bytes [initial] [rendered]
chunk {3} inline.723114ead04c6055da6b.bundle.js (inline) 1.45 kB [entry] [rendered]
➜  testHash git:(master) ng eject --prod --aot
...
➜  testHash git:(master) npm i
...
➜  testHash git:(master)  npm run build
Hash: 061aac4c0e51c4c0ca29 <=====
Version: webpack 3.8.1
Time: 18669ms
                                   Asset       Size  Chunks             Chunk Names
polyfills.245d62a283551f04431d.bundle.js    60.8 kB       0  [emitted]  polyfills
     main.eabb13002b0ed154f44b.bundle.js     152 kB       1  [emitted]  main
   inline.c21ac12d3c43e4c7c0c1.bundle.js    1.45 kB       3  [emitted]  inline
  styles.d41d8cd98f00b204e980.bundle.css    0 bytes       2  [emitted]  styles
                             favicon.ico    5.43 kB          [emitted]  
                            ./index.html  591 bytes          [emitted]  
                    3rdpartylicenses.txt    3.29 kB          [emitted] 
...
➜  testHash git:(master) npm run build
Hash: 12e3523ac034f26a628d <=====
Version: webpack 3.8.1
Time: 19587ms
                                   Asset       Size  Chunks             Chunk Names
polyfills.245d62a283551f04431d.bundle.js    60.8 kB       0  [emitted]  polyfills
     main.eabb13002b0ed154f44b.bundle.js     152 kB       1  [emitted]  main
   inline.c21ac12d3c43e4c7c0c1.bundle.js    1.45 kB       3  [emitted]  inline
  styles.d41d8cd98f00b204e980.bundle.css    0 bytes       2  [emitted]  styles
                             favicon.ico    5.43 kB          [emitted]  
                            ./index.html  591 bytes          [emitted]  
                    3rdpartylicenses.txt    3.29 kB          [emitted]

Observed behavior

After ng eject the main hash are not reliably the same, regardless of no change. Interestingly enough, the chunkhashes are the same, but the main hash changes.

Desired behavior

Running the build task two times consecutively should render the same results. This may be related to a plugin order issue.

Metadata

Metadata

Assignees

Labels

P5The team acknowledges the request but does not plan to address it, it remains open for discussionhelp wantedneeds: investigationRequires some digging to determine if action is neededtype: bug/fix

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions