Skip to content

Commit

Permalink
chore: update random port
Browse files Browse the repository at this point in the history
  • Loading branch information
hunghg255 committed May 31, 2024
1 parent 112a391 commit 0b5751b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export const pluginReactInspector = (options?: {
top?: string;
};
}): RsbuildPlugin => {
let port = 4567;

const position = {
left: options?.position?.left || 'auto',
right: options?.position?.right || '15px',
Expand All @@ -23,17 +21,18 @@ export const pluginReactInspector = (options?: {

return {
name: 'rsbuild-plugin-react-inspector',
setup(api) {
async setup(api) {
if (
api.context.bundlerType === 'webpack' ||
process.env.NODE_ENV !== 'development'
) {
return;
}

const port = await getRandomPort();

api.modifyRsbuildConfig(async (config) => {
const tags: any = config?.html?.tags || [];
port = await getRandomPort();

setConfig(config, 'html.tags', [
...tags,
Expand Down

0 comments on commit 0b5751b

Please sign in to comment.