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

[Bug]: live reload of styles lazy components is broken when using hashes in names #6869

Open
dartess opened this issue Jun 20, 2024 · 5 comments
Assignees
Labels
bug Something isn't working same as webpack The behavior is the same as Webpack stale

Comments

@dartess
Copy link

dartess commented Jun 20, 2024

System Info

System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Memory: 6.46 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.12.1 - /usr/local/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 10.5.0 - /usr/local/bin/npm
pnpm: 8.4.0 - ~/Library/pnpm/pnpm
bun: 1.0.28 - ~/.bun/bin/bun
Browsers:
Brave Browser: 126.1.67.116
Chrome: 126.0.6478.62
Chrome Canary: 128.0.6544.0
Edge: 111.0.1661.54
Safari: 17.5
Safari Technology Preview: 17.4
npmPackages:
@rspack/cli: ^0.7.4 => 0.7.4
@rspack/core: ^0.7.4 => 0.7.4
@rspack/plugin-react-refresh: ^0.7.4 => 0.7.4

Details

When using dev server and HMR I noticed the following:

  1. updating styles for the main components work correctly.

  2. updating styles for components lazily loaded via import() is left for one iteration.

Example:

  • change the background color from blue to red, save the file.
  • HMR is triggered, judging by the console.

Expected result: background is red
Actual result: the background still blue.

  • now change the background color from red to yellow, save the file.
  • HMR is triggered, judging by the console.

Expected result: background is yellow
Actual result: background turned red

I tried to reproduce the minimal repl and the problem seems to appear when using [fullhash] or [contenthash] in the output.filename / output.chunkFilename.

(although at some point the styles of the main components stopped updating completely)

Reproduce link

https://github.com/dartess/rspack-hmr-bug

Reproduce Steps

  1. run npm run dev
  2. change background-color in src/Page/Page.module.css with some another color color#1

Expected result: background is color#1
Actual result: the background still indianred.

  1. change background-color in src/Page/Page.module.css with some another color color#2

Expected result: background is color#2
Actual result: the background turned color#1.

@dartess dartess added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jun 20, 2024
@dartess dartess changed the title [Bug]: live reload of styles is broken when using hashes in names [Bug]: live reload of styles lazy components is broken when using hashes in names Jun 20, 2024
@JSerFeng JSerFeng self-assigned this Jun 20, 2024
@JSerFeng JSerFeng removed the pending triage The issue/PR is currently untouched. label Jun 20, 2024
@JSerFeng
Copy link
Contributor

JSerFeng commented Jul 8, 2024

I think this is related to webpack-contrib/mini-css-extract-plugin#444

@JSerFeng JSerFeng closed this as completed Jul 8, 2024
@dartess
Copy link
Author

dartess commented Jul 8, 2024

I have no idea how the link to that issue helps solve the problem in the attached repl.

Anyway, the workaround is to not use hashes in names during development.

@JSerFeng
Copy link
Contributor

JSerFeng commented Jul 9, 2024

I have no idea how the link to that issue helps solve the problem in the attached repl.

Sorry, we don't have solutions to this at present, I'll keep this open till we fix this

@JSerFeng JSerFeng reopened this Jul 9, 2024
@hardfist hardfist added the same as webpack The behavior is the same as Webpack label Aug 13, 2024
Copy link

stale bot commented Oct 12, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Oct 12, 2024
@dartess
Copy link
Author

dartess commented Oct 12, 2024

bump

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 stale
Projects
None yet
Development

No branches or pull requests

3 participants