Skip to content

Non-deterministic css filename with emitCss #224

Open
@tsmigiel

Description

@tsmigiel

I use svelte-loader with emitCss: true and then MiniCssExtractPlugin in my webpack config. I also use svelte-spa-router with the wrap functionality to break my modules up into many chunks. And I use [contenthash] in my js and css filenames so they will get reloaded when changed.

I was investigating why every time I build all of my files end up with new hashes even for small changes. When I diffed the files of 2 different builds, where I made no changes between builds, the difference was the css filename generated by emitCss. Looking at the code here I see an "index++" and if I remove that in my build, then the generated files and hashes are the same.

I assume that index++ has some purpose, maybe to ensure generated files are unique. Could it be made deterministic? Or is it possible to reduce the cases where it is needed?

I noticed the "Help Wanted" issue, so if someone can explain why "index++" is needed, I don't mind trying to come up with a patch to address it.

Or is there some webpack config workaround I can do?

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