question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

contenthash generates same filename for different contents

See original GitHub issue
  • Operating System: macOS 10.14.6
  • Node Version: v8.11.2
  • NPM Version: 6.0.1
  • webpack Version: 4.41.2
  • mini-css-extract-plugin Version: 0.8.0

Expected Behavior

Should generate different filename when content is changed.

Actual Behavior

Same filename was generated when content is updated.

How Do We Reproduce?

https://github.com/zlk89/webpack-css-contenthash-diff

  • yarn to install packages
  • yarn build
  • under dist folder, you will find two css files with same content hash, while content is different.

Basically contenthash is same, when import statement order is different:

// in js
@import 'a.scss';
@import 'b.scss';
// in js
@import 'b.scss';
@import 'a.scss';

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zlk89commented, Feb 22, 2021

verified the bug has been fixed

0reactions
zlk89commented, Feb 5, 2021

^ bump, this bug essentially prevents us from utilizing long term cache on all css generated by this plugin

Read more comments on GitHub >

github_iconTop Results From Across the Web

contenthash changing even though file remains identical #7984
So chunk- has the same name but file- has a different name when the chunkFilename changes. If the current behavior is a bug,...
Read more >
In Webpack, how do I generate a content hash for only some ...
You mean something like this => const productionConfig = merge([ { output: { chunkFilename: "[name].[contenthash].js", filename: "[name].
Read more >
Adding Hashes to Filenames - SurviveJS
[contenthash] - Returns a hash generated based on content. ... The same result can be achieved by generating static filenames and invalidating the...
Read more >
What is Output — Webpack 5 - DEV Community ‍ ‍
If the contents of the files are not changed, then the same hash value is generated. The chunkFilename determines the name of the...
Read more >
Webpack 5 release (2020-10-10)
The warning Multiple assets emit different content to the same filename has been made an error. ExportsInfo. The way how information about ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found