vite-node
Advanced tools
Comparing version 0.28.4 to 0.28.5
@@ -5,2 +5,3 @@ import { e as ViteNodeServerOptions } from './types-63205a44.js'; | ||
root?: string; | ||
script?: boolean; | ||
config?: string; | ||
@@ -7,0 +8,0 @@ watch?: boolean; |
{ | ||
"name": "vite-node", | ||
"version": "0.28.4", | ||
"version": "0.28.5", | ||
"description": "Vite as Node.js runtime", | ||
@@ -5,0 +5,0 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", |
@@ -51,2 +51,28 @@ <p align="center"> | ||
### Hashbang | ||
If you prefer to write scripts that don't need to be passed into Vite Node, you can declare it in the [hashbang](https://bash.cyberciti.biz/guide/Shebang). | ||
Simply add `#!/usr/bin/env vite-node --script` at the top of your file: | ||
_file.ts_ | ||
```ts | ||
#!/usr/bin/env vite-node --script | ||
console.log('argv:', process.argv.slice(2)) | ||
``` | ||
And make the file executable: | ||
```sh | ||
chmod +x ./file.ts | ||
``` | ||
Now, you can run the file without passing it into Vite Node: | ||
```sh | ||
$ ./file.ts hello | ||
argv: [ 'hello' ] | ||
``` | ||
Note that when using the `--script` option, Vite Node forwards every argument and option to the script to execute, even the one supported by Vite Node itself. | ||
## Programmatic Usage | ||
@@ -53,0 +79,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
103713
2794
187