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

hash code not changing in inline.js file during build #3311

Closed
arozwalak opened this issue Nov 29, 2016 · 15 comments · Fixed by #3609
Closed

hash code not changing in inline.js file during build #3311

arozwalak opened this issue Nov 29, 2016 · 15 comments · Fixed by #3609

Comments

@arozwalak
Copy link

Please provide us with the following information:

OS?

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

Any OS

Versions.

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

1.0.0-beta.21

Repro steps.

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

I have an app with lazy loaded modules. I made a change in one of modules and run build.prod. I noticed that bundled file has changed (also it's hash code in filename has changed), as well as content of inline.bundle.js file has changed updating module bundle file hash code. But hash code for inline.bundle.js file is the same as previous so it's loading cached file inline.bundle.js instead of updated file.

The log given by the failure.

Normally this include a stack trace and some more information.

no log here

Mention any other details that might be useful.

Related to #2899


Thanks! We'll be in touch soon.

@grizzm0
Copy link
Contributor

grizzm0 commented Nov 29, 2016

This has already been discussed in #3221.

If the content of the file doesn't change the hash stays the same. inline.js and style.js does not change between versions as it's basically some webpack stuff in them.

@elvirdolic
Copy link

elvirdolic commented Nov 29, 2016

@grizzm0 the content change.

!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var f,u,i,d=0,b=[];d<t.length;d++)u=t[d],o[u]&&b.push(o[u][0]),o[u]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(t,c,a);b.length;)b.shift()();if(a)for(d=0;d<a.length;d++)i=r(r.s=a[d]);return i};var t={},o={13:0};r.e=function(e){function n(){c.onerror=c.onload=null,clearTimeout(a);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,c.src=r.p+""+e+"."+{0:"3bdbc8e7b2841efae432",1:"c4bbeb9c156937ca1b4c",2:"f84e7fc8276a7fa4ab41",3:"19cf17ee80374c5d1e59",4:"4ddb0a3e93b38dc2f31c",5:"5a0a072bf13b6a980ecd",6:"87ea868fe9a7cbd0fb9b",7:"f3e51549b8156845552e",8:"57a8e2a25f912d22ccbc",9:"4d3f4b3ae6329395f50b",10:"ec9ce598477c189844a3",11:"6e6e88ef601616d98105",12:"58e065928ed8ebd0b582"}[e]+".chunk.js";var a=setTimeout(n,12e4);c.onerror=c.onload=n,t.appendChild(c);var f=new Promise(function(r,n){o[e]=[r,n]});return o[e][2]=f},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,r,n){Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r.oe=function(e){throw console.error(e),e}}([]); //# sourceMappingURL=inline.d41d8cd98f00b204e980.bundle.map

After a build where the lazy loaded chunks change the file has a different content but the hash is the same. When this happen the application doesn't work because the old inline file is cached.

File after build

!function(e){function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var n=window.webpackJsonp;window.webpackJsonp=function(t,c,a){for(var f,u,i,d=0,b=[];d<t.length;d++)u=t[d],o[u]&&b.push(o[u][0]),o[u]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(t,c,a);b.length;)b.shift()();if(a)for(d=0;d<a.length;d++)i=r(r.s=a[d]);return i};var t={},o={13:0};r.e=function(e){function n(){c.onerror=c.onload=null,clearTimeout(a);var r=o[e];0!==r&&(r&&r[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}if(0===o[e])return Promise.resolve();if(o[e])return o[e][2];var t=document.getElementsByTagName("head")[0],c=document.createElement("script");c.type="text/javascript",c.charset="utf-8",c.async=!0,c.timeout=12e4,c.src=r.p+""+e+"."+{0:"80c2fa94d175997118ba",1:"c4bbeb9c156937ca1b4c",2:"f84e7fc8276a7fa4ab41",3:"19cf17ee80374c5d1e59",4:"4ddb0a3e93b38dc2f31c",5:"5a0a072bf13b6a980ecd",6:"87ea868fe9a7cbd0fb9b",7:"f3e51549b8156845552e",8:"57a8e2a25f912d22ccbc",9:"4d3f4b3ae6329395f50b",10:"ec9ce598477c189844a3",11:"045870dead5d111535f0",12:"58e065928ed8ebd0b582"}[e]+".chunk.js";var a=setTimeout(n,12e4);c.onerror=c.onload=n,t.appendChild(c);var f=new Promise(function(r,n){o[e]=[r,n]});return o[e][2]=f},r.m=e,r.c=t,r.i=function(e){return e},r.d=function(e,r,n){Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(n,"a",n),n},r.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r.oe=function(e){throw console.error(e),e}}([]); //# sourceMappingURL=inline.d41d8cd98f00b204e980.bundle.map

@grizzm0
Copy link
Contributor

grizzm0 commented Nov 29, 2016

Ok, I've looked at it but can't really figure it out.

@filipesilva You've got any idea what could cause this?

@elvirdolic
Copy link

The build used --aot flag. Didn't check with JIT.

@arozwalak
Copy link
Author

I'm building with JIT, and have the same issue. For now I just went back to adding timestamp to filename in index.html (inline.xxxxx.bandle.js?14xxxxxxxx). Also what I noticed is even I clear workspace on Jenkins and run build again, inline.js file gets exactly the same hash as before. Looks for me like it's calculated based on something.

@kylecordes
Copy link

This is a frustrating problem, but rather than fix the problem directly, how about making it evaporate by putting the contents of in-line, in-line? There is already an item for it, #2307.

@elvirdolic
Copy link

It would be great to have a label on this issue. It seems that it isn't tracked.

@bialad
Copy link

bialad commented Dec 8, 2016

New release, this is still not fixed? I'd really like to remove this step from my own build flow.

@grizzm0
Copy link
Contributor

grizzm0 commented Dec 8, 2016

@bialad Feel free to try to find the issue and fix it.

@bialad
Copy link

bialad commented Dec 8, 2016

@grizzm0 I'm sorry if I came of strong. There's just been a lot of breaking changes lately, and it gets frustrating. I understand that this is open source software, free and all that entails.

I'm often looking in to fixing issues my self, and can often find a work around for my project. Like using a gulp task to rectify this after "ng build".

Since this issue seems to originate in webpack, it's way out of my expertise and I doubt my fix would be up to standard.

@elvirdolic
Copy link

Maybe we can put the inline - inline. There are some webpack plugins which can do that.

https://www.npmjs.com/package/html-webpack-inline-chunk-plugin

@kylecordes
Copy link

@elvirdolic See older item #2307 about putting the inline contents actually inline. I added a comment there yesterday with a short bash script workaround for anyone who needs it inline today. This also avoids the problem from this issue of the inline file either not having a hash, or that hash not changing as it should.

@elvirdolic
Copy link

Related to #2868

@a5hik
Copy link

a5hik commented Dec 12, 2016

I too face the same issue and its exist in the latest version ..

angular-cli: 1.0.0-beta.22-1

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
@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
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants