Skip to content

Commit 48c85e4

Browse files
authored
fix: skip open in codesandbox (#2154)
1 parent ff07e26 commit 48c85e4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/core/src/plugins/startUrl.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ export function pluginStartUrl(): RsbuildPlugin {
9696
const config = api.getNormalizedConfig();
9797
const { startUrl, beforeStartUrl } = config.dev;
9898
const { https } = api.context.devServer || {};
99-
const shouldOpen = Boolean(startUrl);
99+
100+
// Skip open in codesandbox. After being bundled, the `open` package will
101+
// try to call system xdg-open, which will cause an error on codesandbox.
102+
// https://github.com/codesandbox/codesandbox-client/issues/6642
103+
const isCodesandbox = process.env.CSB === 'true';
104+
const shouldOpen = Boolean(startUrl) && !isCodesandbox;
100105

101106
if (!shouldOpen) {
102107
return;

0 commit comments

Comments
 (0)