Skip to content

Commit 3a66397

Browse files
committed
Downgrade vite on expo sandboxes
1 parent 078be02 commit 3a66397

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

scripts/utils/yarn.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { join } from 'node:path';
33

44
// TODO -- should we generate this file a second time outside of CLI?
55
import storybookVersions from '../../code/core/src/common/versions';
6+
import { allTemplates } from '../../code/lib/cli-storybook/src/sandbox-templates';
67
import type { AllTemplatesKey } from '../../code/lib/cli-storybook/src/sandbox-templates';
78
import { exec } from './exec';
89

@@ -80,8 +81,9 @@ export const installYarn2 = async ({ cwd, dryRun, debug }: YarnOptions) => {
8081
);
8182
};
8283

83-
export const isViteSandbox = (key?: AllTemplatesKey) =>
84-
!key || key.includes('vite') || key.includes('svelte-kit');
84+
export const isViteSandbox = (key?: AllTemplatesKey) => {
85+
return allTemplates[key as AllTemplatesKey]?.expected.builder === '@storybook/builder-vite';
86+
};
8587

8688
export const addWorkaroundResolutions = async ({
8789
cwd,
@@ -100,13 +102,6 @@ export const addWorkaroundResolutions = async ({
100102

101103
let additionalResolutions = {};
102104

103-
if (isViteSandbox(key)) {
104-
// Override vite to v8 beta for vite-based sandboxes to test Vite 8 compatibility
105-
additionalResolutions = {
106-
vite: '8.0.0-beta.18',
107-
};
108-
}
109-
110105
// add additional resolutions for React 19
111106
if (['nextjs/default-ts', 'nextjs/prerelease', 'react-native-web-vite/expo-ts'].includes(key)) {
112107
additionalResolutions = {
@@ -122,6 +117,12 @@ export const addWorkaroundResolutions = async ({
122117
additionalResolutions = {
123118
'react-docgen': '^8.0.2',
124119
};
120+
} else if (key === 'react-native-web-vite/expo-ts') {
121+
additionalResolutions = {
122+
// The expo sandbox started to break in beta 5, yet to investigate the root cause
123+
// in the meantime, we downgrade to the version where things worked.
124+
vite: '8.0.0-beta.4',
125+
};
125126
}
126127

127128
packageJson.resolutions = {

0 commit comments

Comments
 (0)