Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css HMR not working when css file name has contenthash #3629

Closed
Tracked by #3449
hoivee opened this issue Jun 26, 2023 · 2 comments
Closed
Tracked by #3449

css HMR not working when css file name has contenthash #3629

hoivee opened this issue Jun 26, 2023 · 2 comments
Labels
bug Something isn't working same as webpack The behavior is the same as Webpack

Comments

@hoivee
Copy link

hoivee commented Jun 26, 2023

System Info

System:
OS: Linux 4.4 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900HX
Memory: 33.14 GB / 63.74 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
npmPackages:
@rspack/cli: 0.2.3 => 0.2.3

Details

if set output filename or cssFilename cause css filename include contenthash, css HMR just not working

Reproduce link

No response

Reproduce Steps

set output.finename like 'static/js/[name].[contenthash].js' or set output.cssFilename like 'static/css/chunk.[name].[contenthash].css'

@hoivee hoivee added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jun 26, 2023
@hyf0
Copy link
Collaborator

hyf0 commented Jun 26, 2023

It's a known limitation of Rspack CSS supporting. Webpack has the same behavior as Rspack with enabling experiments.css: true.

You could use this config as a workaround:

cssFilename: isDev ? '[name].css' : '[name][contenthash].css'.

@hyf0 hyf0 added p3-has-workaround same as webpack The behavior is the same as Webpack and removed pending triage The issue/PR is currently untouched. labels Jun 26, 2023
@hoivee hoivee changed the title css HRM not working when css file name has contenthash css HMR not working when css file name has contenthash Jun 27, 2023
@hyf0
Copy link
Collaborator

hyf0 commented Jun 28, 2023

Related Webpack issue: webpack-contrib/mini-css-extract-plugin#444.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working same as webpack The behavior is the same as Webpack
Projects
None yet
Development

No branches or pull requests

3 participants