Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Restore hashing of all CSS file names (#1716) #1717

Merged
merged 2 commits into from
Feb 2, 2021

Conversation

fivemru
Copy link
Contributor

@fivemru fivemru commented Feb 2, 2021

Explicitly use hash in rollup-plugin-css-chunks:

chunkFileNames: '[name]-[hash].css',
entryFileNames: '[name]-[hash].css'

fix #1716

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with npm test and lint the project with npm run lint

@fivemru fivemru changed the title explicitly use hash for all css files (#1716) explicitly use hash for all css file names (#1716) Feb 2, 2021
@benmccann
Copy link
Member

I would expect this to be specified in Rollup's output.entryFileNames and then all plugins should use that instead of needing to specify it on a per-plugin basis

@fivemru
Copy link
Contributor Author

fivemru commented Feb 2, 2021

I would expect this to be specified in Rollup's output.entryFileNames and then all plugins should use that instead of needing to specify it on a per-plugin basis

The point is that config.client.output() contains the .js extension in the entryFileNames and chunkFileNames fields.

entryFileNames: '[name].[hash].js',

Just replace .js with .css I think it will not be completely predictable behavior.

Now the css file names are completely dependent on the defaults in rollup-plugin-css-chunks, due to their change in version 2.0.0 this bug occurred.

As noted at

// TODO this is hacky. refactor out into an external rollup plugin
it is most likely correct to put this in an external plugin.

This pull request simply restores the behavior of version 0.28.10.

Copy link
Member

@benmccann benmccann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense I guess

src/core/create_compilers/RollupCompiler.ts Outdated Show resolved Hide resolved
@benmccann benmccann changed the title explicitly use hash for all css file names (#1716) Restore hashing of all CSS file names (#1716) Feb 2, 2021
@benmccann benmccann merged commit 27fdb91 into sveltejs:master Feb 2, 2021
@istarkov
Copy link
Contributor

istarkov commented Feb 3, 2021

Please release.

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 this pull request may close these issues.

No hash appended to client.css filename in v0.29.0
3 participants