Skip to content

Commit f7ba0d5

Browse files
committed
fix: vite dir
1 parent a3437ec commit f7ba0d5

File tree

1 file changed

+1
-14
lines changed
  • packages/vite/src/node/plugins

1 file changed

+1
-14
lines changed

Diff for: packages/vite/src/node/plugins/oxc.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import path from 'node:path'
22
import url from 'node:url'
3-
import { createRequire } from 'node:module'
43
import type {
54
TransformOptions as OxcTransformOptions,
65
TransformResult as OxcTransformResult,
@@ -526,23 +525,11 @@ export function resolveOxcTranspileOptions(
526525
}
527526
}
528527

529-
let viteDir: string
530-
function getViteDir() {
531-
if (!viteDir) {
532-
let dir = createRequire(import.meta.url).resolve('vite')
533-
while (dir && path.basename(dir) !== 'vite') {
534-
dir = path.dirname(dir)
535-
}
536-
viteDir = dir
537-
}
538-
return viteDir
539-
}
540-
541528
async function generateRuntimeHelpers(
542529
runtimeHelpers: readonly [string, string][],
543530
): Promise<string> {
544531
const bundle = await rolldown({
545-
cwd: getViteDir(),
532+
cwd: url.fileURLToPath(import.meta.url),
546533
input: 'entrypoint',
547534
platform: 'neutral',
548535
logLevel: 'silent',

0 commit comments

Comments
 (0)