Skip to content

Commit

Permalink
fix: ensure that esbuild uses the same working directory as Vite (vit…
Browse files Browse the repository at this point in the history
  • Loading branch information
fwouts authored and aleclarson committed Nov 8, 2021
1 parent 65aff99 commit 00b2df8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/src/node/config.ts
Expand Up @@ -825,6 +825,7 @@ async function bundleConfigFile(
mjs = false
): Promise<{ code: string; dependencies: string[] }> {
const result = await build({
absWorkingDir: process.cwd(),
entryPoints: [fileName],
outfile: 'out.js',
write: false,
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -261,6 +261,7 @@ export async function optimizeDeps(
config.optimizeDeps?.esbuildOptions ?? {}

const result = await build({
absWorkingDir: process.cwd(),
entryPoints: Object.keys(flatIdDeps),
bundle: true,
format: 'esm',
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/optimizer/scan.ts
Expand Up @@ -94,6 +94,7 @@ export async function scanImports(config: ResolvedConfig): Promise<{
await Promise.all(
entries.map((entry) =>
build({
absWorkingDir: process.cwd(),
write: false,
entryPoints: [entry],
bundle: true,
Expand Down

0 comments on commit 00b2df8

Please sign in to comment.