Skip to content

Commit d352c1b

Browse files
authored
refactor: use Rolldown's @oxc-project/runtime (#321)
1 parent d8901ca commit d352c1b

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

packages/vite/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
},
8282
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
8383
"dependencies": {
84-
"@oxc-project/runtime": "0.75.0",
8584
"fdir": "^6.4.6",
8685
"lightningcss": "^1.30.1",
8786
"picomatch": "^4.0.2",

packages/vite/src/node/plugins/oxc.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from 'node:path'
22
import url from 'node:url'
3+
import { createRequire } from 'node:module'
34
import type {
45
TransformOptions as OxcTransformOptions,
56
TransformResult as OxcTransformResult,
@@ -372,8 +373,9 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
372373

373374
return result
374375
}
376+
const require = createRequire(/** #__KEEP__ */ import.meta.url)
375377
const runtimeResolveBase = normalizePath(
376-
url.fileURLToPath(/** #__KEEP__ */ import.meta.url),
378+
require.resolve('rolldown/package.json'),
377379
)
378380

379381
let server: ViteDevServer
@@ -389,7 +391,7 @@ export function oxcPlugin(config: ResolvedConfig): Plugin {
389391
},
390392
async handler(id, _importer, opts) {
391393
// @oxc-project/runtime imports will be injected by OXC transform
392-
// since it's injected by the transform, @oxc-project/runtime should be resolved to the one Vite depends on
394+
// since it's injected by the transform, @oxc-project/runtime should be resolved to the one Rolldown depends on
393395
const resolved = await this.resolve(id, runtimeResolveBase, opts)
394396
return resolved
395397
},

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)