mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 11:56:36 +08:00
Use module.createRequire instead fs.readFile for import package.json
This commit is contained in:
parent
ac55656eca
commit
16917388d1
@ -1,14 +1,14 @@
|
||||
process.env.NODE_ENV = 'development'
|
||||
|
||||
import { readFileSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
import electron from 'electron'
|
||||
import { spawn } from 'child_process'
|
||||
import { createRequire } from 'module'
|
||||
import { createServer, build as viteBuild } from 'vite'
|
||||
import chalk from 'chalk'
|
||||
|
||||
const TAG = chalk.bgGreen(' dev.mjs ')
|
||||
const pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'))
|
||||
const require = createRequire(import.meta.url)
|
||||
const pkg = require('../package.json')
|
||||
|
||||
/**
|
||||
* @param {{ name: string; configFile: string; writeBundle: import('rollup').OutputPlugin['writeBundle'] }} param0
|
||||
|
Loading…
x
Reference in New Issue
Block a user