Skip to content

Commit

Permalink
Build: Temporarily downgrade Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Nov 27, 2024
1 parent d4ecd0d commit 182c509
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 3 additions & 2 deletions scripts/tasks/sandbox-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export const install: Task['run'] = async ({ sandboxDir, key }, { link, dryRun,
'svelte-vite/default-ts',
'vue3-vite/default-js',
'vue3-vite/default-ts',
'svelte-kit/skeleton-ts',
];
if (sandboxesNeedingWorkarounds.includes(key)) {
await addWorkaroundResolutions({ cwd, dryRun, debug });
if (sandboxesNeedingWorkarounds.includes(key) || key.includes('vite')) {
await addWorkaroundResolutions({ cwd, dryRun, debug, key });
}

await exec(
Expand Down
15 changes: 14 additions & 1 deletion scripts/utils/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export const installYarn2 = async ({ cwd, dryRun, debug }: YarnOptions) => {
);
};

export const addWorkaroundResolutions = async ({ cwd, dryRun }: YarnOptions) => {
export const addWorkaroundResolutions = async ({
cwd,
dryRun,
key,
}: YarnOptions & { key?: TemplateKey }) => {
logger.info(`🔢 Adding resolutions for workarounds`);

if (dryRun) {
Expand All @@ -81,10 +85,19 @@ export const addWorkaroundResolutions = async ({ cwd, dryRun }: YarnOptions) =>
// Due to our support of older vite versions
'@vitejs/plugin-react': '4.2.0',
'@vitejs/plugin-vue': '4.5.0',
// TODO: Remove this once we figure out how to properly test Vite 4, 5 and 6 in our sandboxes
vite: '^5.0.0',
// We need to downgrade the plugin so that it works with Vite 5 projects
'@sveltejs/vite-plugin-svelte': '4.0.2',
'@testing-library/dom': '^9.3.4',
'@testing-library/jest-dom': '^6.5.0',
'@testing-library/user-event': '^14.5.2',
};

if (key.includes('svelte-kit')) {
packageJson.resolutions['@sveltejs/vite-plugin-svelte'] = '^3.0.0';
}

await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
};

Expand Down

0 comments on commit 182c509

Please sign in to comment.