15
15
. version ( version )
16
16
. option ( '-r, --root <path>' , 'Use specified root directory' )
17
17
. option ( '-c, --config <path>' , 'Use specified config file' )
18
+ . option ( '-m, --mode <mode>' , 'Set env mode' )
18
19
. option ( '-w, --watch' , 'Restart on file changes, similar to "nodemon"' )
19
20
. option ( '--script' , 'Use vite-node as a script runner' )
20
21
. option ( '--options <options>' , 'Use specified Vite server options' )
@@ -31,6 +32,7 @@ export interface CliOptions {
31
32
root ?: string
32
33
script ?: boolean
33
34
config ?: string
35
+ mode ?: string
34
36
watch ?: boolean
35
37
options ?: ViteNodeServerOptionsCLI
36
38
'--' ?: string [ ]
@@ -60,6 +62,7 @@ async function run(files: string[], options: CliOptions = {}) {
60
62
logLevel : 'error' ,
61
63
configFile : options . config ,
62
64
root : options . root ,
65
+ mode : options . mode ,
63
66
plugins : [
64
67
options . watch && viteNodeHmrPlugin ( ) ,
65
68
] ,
@@ -115,13 +118,13 @@ function parseServerOptions(serverOptions: ViteNodeServerOptionsCLI): ViteNodeSe
115
118
...serverOptions . deps ,
116
119
inline : inlineOptions !== true
117
120
? inlineOptions . map ( ( dep ) => {
118
- return dep . startsWith ( '/' ) && dep . endsWith ( '/' )
121
+ return ( dep . startsWith ( '/' ) && dep . endsWith ( '/' ) )
119
122
? new RegExp ( dep )
120
123
: dep
121
124
} )
122
125
: true ,
123
126
external : toArray ( serverOptions . deps ?. external ) . map ( ( dep ) => {
124
- return dep . startsWith ( '/' ) && dep . endsWith ( '/' )
127
+ return ( dep . startsWith ( '/' ) && dep . endsWith ( '/' ) )
125
128
? new RegExp ( dep )
126
129
: dep
127
130
} ) ,
0 commit comments