Angular-cli: 使用@angular/cli 使用 ng build --prod 打包后生成的文件hash 值不对

Created on 11 Jan 2018  ·  8Comments  ·  Source: angular/angular-cli

Versions

Angular CLI: 1.5.0
Node: 8.9.1
OS: linux x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.6.2
webpack: 3.10.0

Repro steps

  • Step 1
    ng build --prod
  • Step 2
    每次生成的文件名都相同,hash没有生效
  • Step 3

Observed behavior

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

Desired behavior

Mention any other details that might be useful (optional)

more info

Most helpful comment

@StephenFluin @intellix
His description of the problem is not detailed enough. I would like to investigate with him in Chinese first and then translate the conclusion into English.

@yushk 你能做一个能复现此问题的最小化工程,上传到 github 的一个开放仓库中吗?另外,你所说的没生效是指没有添加 hash 还是指添加了但每次添加的 hash 都一样?在你没有改动源代码的情况下,每次 build 的 hash 就应该是一样的,这本来就是设计意图。
另外,如果用中文提 issue,请直接 @我,或者提到 angular-cn 仓库下(虽然是文档仓库,不过也可以回复一些简单的技术问题),这样就不会给其他成员造成困扰了。

All 8 comments

Google translate of the above says that after an ng build, the generated hash values are incorrect

@asnowwolf My Chinese isn't very good. Can you help us understand or respond to this issue?

@StephenFluin @intellix
His description of the problem is not detailed enough. I would like to investigate with him in Chinese first and then translate the conclusion into English.

@yushk 你能做一个能复现此问题的最小化工程,上传到 github 的一个开放仓库中吗?另外,你所说的没生效是指没有添加 hash 还是指添加了但每次添加的 hash 都一样?在你没有改动源代码的情况下,每次 build 的 hash 就应该是一样的,这本来就是设计意图。
另外,如果用中文提 issue,请直接 @我,或者提到 angular-cn 仓库下(虽然是文档仓库,不过也可以回复一些简单的技术问题),这样就不会给其他成员造成困扰了。

Hashing plugin used here (sha-384): https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/models/webpack-configs/browser.ts#L75

Hashing done here: https://github.com/waysact/webpack-subresource-integrity/blob/master/index.js#L175

Are those hashes correct? I'm not sure how to verify the integrity of my bundles to be honest

@asnowwolf hi, you are very friendly. I have a very strange problem. Can I ask you by some other way. After I update to the latest version of Angular CLI. Every time I build need 40 minutes.

@zuo305 Yes, if you speak Chinese too, please add my wechat: asnowwolf .

package.json自己加参数 --output-hashing=bundles
demo:
"build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --aot -prod --output-hashing=bundles --base-href /v2/",

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