We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
System: OS: macOS 15.1.1 CPU: (16) arm64 Apple M3 Max Memory: 302.09 MB / 48.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.12.0 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/node Yarn: 1.22.22 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/yarn npm: 10.9.0 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/npm pnpm: 9.15.2 - ~/Library/pnpm/pnpm bun: 1.1.39 - ~/.bun/bin/bun Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman Browsers: Chrome: 131.0.6778.205 Edge: 131.0.2903.112 Safari: 18.1.1
在 qiankun 中使用 rsbuild 时, qiankun 加载子应用时设置
sandbox: { experimentalStyleIsolation: true, }
当 experimentalStyleIsolation 被设置为 true 时,qiankun 会改写子应用所添加的样式为所有样式规则增加一个特殊的选择器规则来限定其影响范围,会把 link 改写成style, 目前cssExtractHmr.js 中css 的热更新是获取所有 link 标签进行更新,因此失效了,我把experimentalStyleIsolation设置为 false 可以进行热更新
迁移前使用 webpack 没有这个问题
https://github.com/cl1107/qiankun-rsbuild-css-hmr-lose-effect
cd main pnpm i pnpm run start
cd vue3 pnpm i pnpm run start
cd vue pnpm i pnpm run start vue目录是使用 vue-cli ,热更新是正常的, vue3 目录是使用 rsbuild 更新不正常
The text was updated successfully, but these errors were encountered:
我对比了一下 rsbuild 和 vue-cli最后生成配置,发现 vue-cli 最后生成的配置有使用style-laoder,而 rsbuild 没有使用,因此我尝试在 rsbuild 中开启 style-loader,在配置中将output.injectStyles设置为true即可开始,试了一下这样开启后可以解决这个热更新问题,因为不推荐在生产中开启这个特性,因此使用如下配置
output: { injectStyles: process.env.NODE_ENV === 'development', },
参考链接:https://rsbuild.dev/zh/config/output/inject-styles
Sorry, something went wrong.
No branches or pull requests
System Info
System:
OS: macOS 15.1.1
CPU: (16) arm64 Apple M3 Max
Memory: 302.09 MB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/node
Yarn: 1.22.22 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/yarn
npm: 10.9.0 - ~/.local/state/fnm_multishells/29482_1735549145825/bin/npm
pnpm: 9.15.2 - ~/Library/pnpm/pnpm
bun: 1.1.39 - ~/.bun/bin/bun
Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 131.0.6778.205
Edge: 131.0.2903.112
Safari: 18.1.1
Details
在 qiankun 中使用 rsbuild 时, qiankun 加载子应用时设置
当 experimentalStyleIsolation 被设置为 true 时,qiankun 会改写子应用所添加的样式为所有样式规则增加一个特殊的选择器规则来限定其影响范围,会把 link 改写成style,
目前cssExtractHmr.js 中css 的热更新是获取所有 link 标签进行更新,因此失效了,我把experimentalStyleIsolation设置为 false 可以进行热更新
迁移前使用 webpack 没有这个问题
Reproduce link
https://github.com/cl1107/qiankun-rsbuild-css-hmr-lose-effect
Reproduce Steps
cd main
pnpm i
pnpm run start
cd vue3
pnpm i
pnpm run start
cd vue
pnpm i
pnpm run start
vue目录是使用 vue-cli ,热更新是正常的, vue3 目录是使用 rsbuild 更新不正常
The text was updated successfully, but these errors were encountered: