Skip to content

Content hash does not change when using DependencyExtractionWebpackPlugin in combination with CSS files #69895

@danielpost

Description

@danielpost

Description

When following the steps outlined in Build Process or when importing a stylesheet in a JS file, the DependencyExtractionWebpackPlugin in the scripts package does not take into account the contents of the CSS file(s) when generating the version hash. This makes it impossible to use the version number for cache busting purposes.

I created a small Webpack plugin (aptly named DependencyExtractionCssHashFixerWebpackPlugin) to fix this by regenerating a hash for CSS files, but it would be nice to fix this in the package itself.

Step-by-step reproduction instructions

  1. Follow the steps outlined in Build Process.
  2. Run npm run build and note the version hash in one of the files (e.g. cat public/css/screen.asset.php)
  3. Make a change in the Sass file and run npm run build again.
  4. See that the version hash did not change.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions