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(vite): import esbuild before loading config to keep it in cache #21685

Merged
merged 1 commit into from Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/vite/src/plugins/plugin.ts
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