Skip to content

Commit

Permalink
feat: Add es-main compatibility to vite-node (#4751)
Browse files Browse the repository at this point in the history
  • Loading branch information
zookatron authored Dec 15, 2023
1 parent 14c5966 commit 486a3e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite-node/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { resolve } from 'node:path'
import cac from 'cac'
import c from 'picocolors'
import { createServer } from 'vite'
Expand Down Expand Up @@ -54,7 +55,7 @@ async function run(files: string[], options: CliOptions = {}) {
if (options.script) {
files = [files[0]]
options = {}
process.argv = [process.argv[0], files[0], ...process.argv.slice(2).filter(arg => arg !== '--script' && arg !== files[0])]
process.argv = [process.argv[0], resolve(files[0]), ...process.argv.slice(2).filter(arg => arg !== '--script' && arg !== files[0])]
}
else {
process.argv = [...process.argv.slice(0, 2), ...(options['--'] || [])]
Expand Down

0 comments on commit 486a3e6

Please sign in to comment.