docs(web): add instructions for Vite
This commit is contained in:
parent
07aaf2322e
commit
6c4a50a9c7
2 changed files with 111 additions and 96 deletions
|
|
@ -27,7 +27,22 @@ const Parser = require('web-tree-sitter');
|
|||
Parser.init().then(() => { /* the library is ready */ });
|
||||
```
|
||||
|
||||
You can use this module with [deno](https://deno.land/):
|
||||
or Vite:
|
||||
|
||||
```js
|
||||
import Parser from 'web-tree-sitter';
|
||||
Parser.init().then(() => { /* the library is ready */ });
|
||||
```
|
||||
|
||||
With Vite, you also need to make sure your server provides the `tree-sitter.wasm`
|
||||
file to your `public` directory. You can do this automatically with a `postinstall`
|
||||
[script](https://docs.npmjs.com/cli/v10/using-npm/scripts) in your `package.json`:
|
||||
|
||||
```js
|
||||
"postinstall": "cp node_modules/web-tree-sitter/tree-sitter.wasm public"
|
||||
```
|
||||
|
||||
You can also use this module with [deno](https://deno.land/):
|
||||
|
||||
```js
|
||||
import Parser from "npm:web-tree-sitter";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue