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

feat: Enable HMR on shared Rsbuild configuration #2700

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion config/rsbuild-config-cozy-app/getRsbuildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,29 @@ function getRsbuildConfig({
plugins: [
pluginEjs(),
pluginNodePolyfill(),
pluginReact(),
pluginReact({
fastRefresh: import.meta.env.NODE_ENV === 'development'
}),
pluginStylus({
stylusOptions: {
// To resolve import from cozy-ui inside stylus files
paths: [path.resolve(appPath, 'node_modules', 'cozy-ui', 'stylus')]
}
})
],
// Used when running `rsbuild dev`
// By default the dev configuration would serve app's files from localhost:300
// which is not what we want as we expect to serve apps from a local cozy-stack
dev: {
// this param tells to put files in the output folder so we can access them from cozy-stack
writeToDisk: true,
// this param tells the cozy-app which URL to use for the HMR websocket, otherwise it would use the cozy-stack URL by default
client: {
host: 'rsbuild.cozy.tools', // we cannot use localhost because chromium browsers prevent unsecure websockets to localhost
protocol: 'ws',
port: '<port>'
}
},
output: {
cleanDistPath: true,
filename: {
Expand Down
Loading