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

fix: do not open browser when open parameter is set to false #4291

Closed
wants to merge 1 commit into from

Conversation

esskar
Copy link

@esskar esskar commented Dec 29, 2024

Summary

Allows to disable browser opening by setting the open parameter to false.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@CLAassistant
Copy link

CLAassistant commented Dec 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

netlify bot commented Dec 29, 2024

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 81de6f8
🔍 Latest deploy log https://app.netlify.com/sites/rsbuild/deploys/6771c10a9a0eb60008f91a6f
😎 Deploy Preview https://deploy-preview-4291--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 74 (🔴 down 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

const { open } = config.server;

if (typeof open === 'boolean') {
return { targets: [] };
return { targets: [], skip: !open };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem necessary, the server plugin already checks if open is false:

https://github.com/web-infra-dev/rsbuild/blob/main/packages/core/src/plugins/server.ts#L15

Copy link
Author

@esskar esskar Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then there must be something else wrong as

import { defineConfig } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';

export default defineConfig({
  plugins: [pluginReact()],
  server: {
    open: false,
  },
});

still opens the browser after the server started.

i am using "@rsbuild/core": "^1.1.13"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using the --open CLI flag? The CLI flag takes precedence over the configurations,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no, it is part of the package dev script. thanks. sorry for the confusion. will close it.

@esskar esskar closed this Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants