File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1818 . option ( '-c, --config <path>' , 'Use specified config file' )
1919 . option ( '-m, --mode <mode>' , 'Set env mode' )
2020 . option ( '-w, --watch' , 'Restart on file changes, similar to "nodemon"' )
21+ . option ( '--inspect' , 'Enable Node.js inspector' )
22+ . option ( '--inspect-addr [host:port]' , 'Enable Node.js inspector with specified address' )
2123 . option ( '--script' , 'Use vite-node as a script runner' )
2224 . option ( '--options <options>' , 'Use specified Vite server options' )
2325 . option ( '-v, --version' , 'Output the version number' )
@@ -43,13 +45,21 @@ export interface CliOptions {
4345 'config' ?: string
4446 'mode' ?: string
4547 'watch' ?: boolean
48+ 'inspect' ?: boolean
49+ 'inspectAddr' ?: string
4650 'options' ?: ViteNodeServerOptionsCLI
4751 'version' ?: boolean
4852 'help' ?: boolean
4953 '--' ?: string [ ]
5054}
5155
5256async function run ( files : string [ ] , options : CliOptions = { } ) {
57+ if ( options . inspect || options . inspectAddr ) {
58+ const { open } = await import ( 'node:inspector' )
59+ const [ host , port ] = options . inspectAddr ?. split ( ':' ) || [ '127.0.0.1' , '9229' ]
60+ open ( Number ( port ) , host , false )
61+ }
62+
5363 if ( options . script ) {
5464 files = [ files [ 0 ] ]
5565 options = { }
You can’t perform that action at this time.
0 commit comments