Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong hashing for scripts production bundle #2868

Closed
ShadowManu opened this issue Oct 24, 2016 · 4 comments · Fixed by #3609
Closed

Wrong hashing for scripts production bundle #2868

ShadowManu opened this issue Oct 24, 2016 · 4 comments · Fixed by #3609
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@ShadowManu
Copy link

ShadowManu commented Oct 24, 2016

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Linux x64 (Ubuntu 16.04)

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.17
node: 6.5.0

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Using the CLI for dev/prod for more than a month. Updating to latest version continously.

The log given by the failure.

Normally this include a stack trace and some more information.

No errors related. (Only webpack production warnings)

Mention any other details that might be useful.

The hashed name generated for scripts.**.bundle.js generated for different versions of the same app (like adding a service) is the same while the bundle content has differences (seems like chunk numbers generated by webpack).

Example flow to replicate:
create an app
add a script to angular-cli.json
generate a production bundle <-- generates a scripts bundle with a hash X.
add some TS module to the app (like a new component)
generate a production bundle <-- generates a scripts bundle with the same hash X but the content is different (in particular, webpack-related chunk numbers).

This affects production caching since the bundle cannot be invalidated by name since the hash works 'fake' (same hash, different content, enough to make the app fail to load).


Thanks! We'll be in touch soon.

@filipesilva filipesilva added type: bug/fix command: build P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Nov 2, 2016
@filipesilva
Copy link
Contributor

Thanks for the report. This looks like a bug somewhere.

@hansl hansl modified the milestone: RC1 Nov 11, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
hansl added a commit to hansl/angular-cli that referenced this issue Dec 17, 2016
@rcomblen
Copy link

Issue still there with beta 25.

Struggled half a day to understand why my app wasn't loading anymore when served thru Cloudfront.

Stumbled across this issue, updated to beta 25 to have your fix. Doesn't work for me.

I build with ng build --prod --aot

To test your fix, I did:

  • build once
  • change the content of one of my service file
  • build again

the inline.XXX.js has the same hash be a different content.
The difference is the following:

c.src=r.p+""+e+"."+{0:"c66703c4cd276dc1f7c0"

c.src=r.p+""+e+"."+{0:"9745f38a9de532556cb0"

The id there is the corresponds to the hash of my main.XXX.js: dist/main.9745f38a9de532556cb0.bundle.js

So obviously the problem is not solved ...

@rcomblen
Copy link

Further, these file names are only referred to in the index.html and the source maps. The hash should have a value that is easy to check, it should be the md5sum or sha1sum of the file.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants