Skip to content

Commit 1d9fa39

Browse files
authored
refactor: use JSON import attributes instead of readFileSync in constants (#23258)
1 parent 2804636 commit 1d9fa39

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

‎packages/vite/src/node/constants.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import path, { resolve } from 'node:path'
22
import { fileURLToPath } from 'node:url'
3-
import { readFileSync } from 'node:fs'
3+
import { version } from '../../package.json' with { type: 'json' }
44
import type { RollupPluginHooks } from './typeUtils'
55

6-
const { version } = JSON.parse(
7-
readFileSync(new URL('../../package.json', import.meta.url)).toString(),
8-
)
9-
106
export const ROLLUP_HOOKS: RollupPluginHooks[] = [
117
'options',
128
'buildStart',

0 commit comments

Comments
 (0)