You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/clients/01-typescript.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,37 @@ ignite generate ts-client
35
35
36
36
To prevent regenerating the client, remove the `client:typescript` property from `config.yml`.
37
37
38
+
## Setup
39
+
40
+
The best way to get started building with the TypeScript client is by using a [Vite](https://vitejs.dev/) boilerplate. Vite provides boilerplates for vanilla TS projects as well as react, vue, lit, svelte and preact frameworks.
41
+
You can find additional information at the [Vite Getting Started guide](https://vitejs.dev/guide/).
42
+
43
+
You will also need to polyfill the client's dependencies. The following is an example of setting up a vanilla TS project with the necessary polyfills.
You must then create the necessary `vite.config.ts` file.
51
+
52
+
```typescript
53
+
import { nodeResolve } from '@rollup/plugin-node-resolve'
54
+
import { Buffer } from 'buffer'
55
+
import { defineConfig } from 'vite'
56
+
57
+
export default defineConfig({
58
+
define: {
59
+
global: {
60
+
Buffer: Buffer
61
+
}
62
+
},
63
+
plugins: [nodeResolve()],
64
+
})
65
+
```
66
+
67
+
You are then ready to use the generated client code inside this project directly or by publishing the client and installing it as any other npm package.
68
+
38
69
## Usage
39
70
40
71
The code generated in `ts-client` comes with a `package.json` file ready to publish which you can modify to suit your needs.
0 commit comments