Skip to content

contenthash changing even though file remains identical #8419

@rightaway

Description

@rightaway

This issue was opened because #7984 was closed saying it's been fixed even though many people have reported that it has definitely not been fixed.

Bug report

	output: {
		filename: 'file-[contenthash].js',
		chunkFilename: 'chunk-[contenthash].js'
	},
        optimization: {
        	splitChunks: {
		chunks: 'all',
		cacheGroups: {
				vendors: {
					test: /[\\/]node_modules[\\/]/,
				},
			},
		},
       }

What is the current behavior?

If I have the above config, in my build I get a file called file-XXX.js and chunk-XXX.js. If I change the config line from chunkFilename: 'chunk-[contenthash].js' to chunkFilename: 'CHUNK-[contenthash].js', then the files are file-YYY.js and chunk-XXX.js. So chunk- has the same name but file- has a different name when the chunkFilename changes.

If the current behavior is a bug, please provide the steps to reproduce.

Create a webpack bundle when the chunkFilename is set to one value, then create another bundle after changing the chunkFilename. You'll see the the contenthash has changed even though the file contents are identical.

What is the expected behavior?

I'm using [contenthash] and in both cases the file contents are identical so the contenthash shouldn't change and the filename should remain the same.

Other relevant information:
webpack version: 4.17.1
Node.js version: 10.9.0
Operating System: linux
Additional tools:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions