Skip to content

Commit 8c10fa7

Browse files
committed
chore: fix add script to tags config
1 parent 765320f commit 8c10fa7

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/index.ts

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { RsbuildPlugin } from '@rsbuild/core';
22

3-
import { resolvePackage } from '@rsbuild/shared';
3+
import { resolvePackage, setConfig } from '@rsbuild/shared';
44
import { startServer } from './server/server';
55

66
export const pluginReactInspector = (options?: {
@@ -20,21 +20,18 @@ export const pluginReactInspector = (options?: {
2020

2121
api.modifyRsbuildConfig((config) => {
2222
const tags: any = config?.html?.tags || [];
23-
config.html = {
24-
tags: [
25-
...tags,
26-
{
27-
tag: 'script',
28-
head: true,
29-
attrs: {
30-
type: 'module',
31-
src: `http://localhost:${port}/virtual-react-inspector-path-load.js`,
32-
},
33-
},
34-
],
35-
};
3623

37-
return config;
24+
setConfig(config, 'html.tags', [
25+
...tags,
26+
{
27+
tag: 'script',
28+
head: true,
29+
attrs: {
30+
type: 'module',
31+
src: `http://localhost:${port}/virtual-react-inspector-path-load.js`,
32+
},
33+
},
34+
]);
3835
});
3936

4037
api.onAfterStartDevServer(() => {

0 commit comments

Comments
 (0)