Replies: 1 comment 3 replies
-
For import { defineConfig, RsbuildPlugin } from "@rsbuild/core";
const envPlugin: RsbuildPlugin = {
name: "env-plugin",
setup(api) {
api.modifyRspackConfig((config, { rspack, environment }) => {
const { client } = environment.config.dev;
config.plugins.push(
new rspack.DefinePlugin({
RSBUILD_CLIENT_CONFIG: JSON.stringify(client),
})
);
});
},
};
export default defineConfig({
output: {
target: "web-worker",
},
plugins: [envPlugin],
}); For |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to implement a custom HMR client for a Chrome extension background script that self-reloads when there is an update. I need some env configs like
RSBUILD_COMPILATION_NAME
,RSBUILD_CLIENT_CONFIG
, andRSBUILD_RESOLVED_CLIENT_CONFIG
to establish the connection. However, these variables do not exist when the target isweb-worker
.I wonder if we can export the
getCompilationId
method to maintain the same behavior. Do you have any other suggestions? Thank you!Beta Was this translation helpful? Give feedback.
All reactions