1515 . version ( version )
1616 . option ( '-r, --root <path>' , 'Use specified root directory' )
1717 . option ( '-c, --config <path>' , 'Use specified config file' )
18+ . option ( '-m, --mode <mode>' , 'Set env mode' )
1819 . option ( '-w, --watch' , 'Restart on file changes, similar to "nodemon"' )
1920 . option ( '--script' , 'Use vite-node as a script runner' )
2021 . option ( '--options <options>' , 'Use specified Vite server options' )
@@ -31,6 +32,7 @@ export interface CliOptions {
3132 root ?: string
3233 script ?: boolean
3334 config ?: string
35+ mode ?: string
3436 watch ?: boolean
3537 options ?: ViteNodeServerOptionsCLI
3638 '--' ?: string [ ]
@@ -60,6 +62,7 @@ async function run(files: string[], options: CliOptions = {}) {
6062 logLevel : 'error' ,
6163 configFile : options . config ,
6264 root : options . root ,
65+ mode : options . mode ,
6366 plugins : [
6467 options . watch && viteNodeHmrPlugin ( ) ,
6568 ] ,
@@ -115,13 +118,13 @@ function parseServerOptions(serverOptions: ViteNodeServerOptionsCLI): ViteNodeSe
115118 ...serverOptions . deps ,
116119 inline : inlineOptions !== true
117120 ? inlineOptions . map ( ( dep ) => {
118- return dep . startsWith ( '/' ) && dep . endsWith ( '/' )
121+ return ( dep . startsWith ( '/' ) && dep . endsWith ( '/' ) )
119122 ? new RegExp ( dep )
120123 : dep
121124 } )
122125 : true ,
123126 external : toArray ( serverOptions . deps ?. external ) . map ( ( dep ) => {
124- return dep . startsWith ( '/' ) && dep . endsWith ( '/' )
127+ return ( dep . startsWith ( '/' ) && dep . endsWith ( '/' ) )
125128 ? new RegExp ( dep )
126129 : dep
127130 } ) ,
0 commit comments