Skip to content

Commit

Permalink
fix(vite): import esbuild before loading config to keep it in cache (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Feb 7, 2024
1 parent e0d8eab commit db8b37f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/vite/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ async function buildViteTargets(
context.workspaceRoot,
configFilePath
);

// Workaround for the `build$3 is not a function` error that we sometimes see in agents.
// This should be removed later once we address the issue properly
try {
const importEsbuild = () => new Function('return import("esbuild")')();
await importEsbuild();
} catch {
// do nothing
}
const { resolveConfig } = await loadViteDynamicImport();
const viteConfig = await resolveConfig(
{
Expand Down

0 comments on commit db8b37f

Please sign in to comment.