angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

Using webpack 4,the content-hash is different on version 1.0.22 but 1.0.0 is same #3771

Closed oliveshell closed 4 years ago

oliveshell commented 5 years ago

This issue tracker is for Bug Reports and Feature Requests only.

Please direct requests for help to StackOverflow. See http://bit.ly/UIR-SOF for details.

This is a (check one box):

My version of UI-Router is: 1.0.22 Webpack: 4.28.4

Bug Report

Current Behavior:

Dear all, When I using the webpack to pack my project,I configure the output as the style as contenthash. I check all the files of my project,then I found the vendor's(node_modules) hash is different every time. Finally i found the ui-router 's version is related to the difference. If i use the 1.0.22 version,I test 100 times build, nearly 30% is same. If I change to the version 1.0.0, 100% is same. However I can't downgrade to 1.0.0,beacuse I use the higher version's feature future state. Help me please!

Expected Behavior:

when I pack all the scripts, if the content is same then I expect the hash is same.

my webpack config: output: { path: helpers.appBuild, filename: '[name].[contenthash:8].js', sourceMapFilename: '[file].map', chunkFilename: '[name].[contenthash:8].js', publicPath: helpers.publicServerBase }, const NamedChunksPlugin = require('webpack/lib/NamedChunksPlugin'); use the plugin: new NamedChunksPlugin( chunk => chunk.name || Array.from(chunk.modulesIterable, m => m.id).join("_") ),

Link to Plunker or stackblitz that reproduces the issue:

( if you want a response to your issue, provide a way to reproduce it ) ( http://bit.ly/UIR-Plunk1 ) ( https://stackblitz.com/edit/ui-router-angularjs )

Feature Request

General Query

Please direct general implementation questions to StackOverflow: http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router

Please review the Sample Application which highlights common approaches: https://github.com/ui-router/sample-app-angularjs

(type general query here)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.

bbrassart commented 3 years ago

Hi all! If anyone still bumps into this issue, I think this behaviour has been introduced in version 1.0.19 https://github.com/angular-ui/ui-router/blob/master/CHANGELOG.md#1019-2018-07-20 of @uirouter/angularjs package. I suspect this change https://github.com/angular-ui/ui-router/commit/8fc3bb2 to be at the source of it. So reverting to 1.0.18, the contenthash produced by Webpack should be consistent.