Skip to content

Commit 0765cc5

Browse files
committed
feat(vite): reflect framework subpaths for config helpers
Also add docs on typeCheck specificity for manual type checking control.
1 parent ac0dfee commit 0765cc5

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

content/configuration/vite.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The plugin comes with several framework integrations.
8383

8484
```ts
8585
import { defineConfig, mergeConfig, UserConfig } from 'vite'
86-
import { vueConfig } from '@nativescript/vite'
86+
import { vueConfig } from '@nativescript/vite/vue'
8787

8888
export default defineConfig(({ mode }): UserConfig => {
8989
return mergeConfig(vueConfig({ mode }), {})
@@ -94,7 +94,7 @@ export default defineConfig(({ mode }): UserConfig => {
9494

9595
```ts
9696
import { defineConfig, mergeConfig, UserConfig } from 'vite'
97-
import { angularConfig } from '@nativescript/vite'
97+
import { angularConfig } from '@nativescript/vite/angular'
9898

9999
export default defineConfig(({ mode }): UserConfig => {
100100
return mergeConfig(angularConfig({ mode }), {})
@@ -105,7 +105,7 @@ export default defineConfig(({ mode }): UserConfig => {
105105

106106
```ts
107107
import { defineConfig, mergeConfig, UserConfig } from 'vite'
108-
import { solidConfig } from '@nativescript/vite'
108+
import { solidConfig } from '@nativescript/vite/solid'
109109

110110
export default defineConfig(({ mode }): UserConfig => {
111111
return mergeConfig(solidConfig({ mode }), {})
@@ -116,18 +116,18 @@ export default defineConfig(({ mode }): UserConfig => {
116116

117117
```ts
118118
import { defineConfig, mergeConfig, UserConfig } from 'vite'
119-
import { solidConfig } from '@nativescript/vite'
119+
import { svelteConfig } from '@nativescript/vite/svelte'
120120

121121
export default defineConfig(({ mode }): UserConfig => {
122-
return mergeConfig(solidConfig({ mode }), {})
122+
return mergeConfig(svelteConfig({ mode }), {})
123123
})
124124
```
125125

126126
### React
127127

128128
```ts
129129
import { defineConfig, mergeConfig, UserConfig } from 'vite'
130-
import { reactConfig } from '@nativescript/vite'
130+
import { reactConfig } from '@nativescript/vite/react'
131131

132132
export default defineConfig(({ mode }): UserConfig => {
133133
return mergeConfig(reactConfig({ mode }), {})
@@ -149,6 +149,24 @@ The above config configures most things required to bundle a NativeScript applic
149149

150150
This page contains examples of common things you might want to change in the [Examples of configurations section](#configuration-examples) - for anything else not mentioned here, refer to the [Vite documentation](https://vite.dev/config/).
151151

152+
## Type checking
153+
154+
Type checking diagnostics come from the project's `tsconfig.json`. By default, the build follows `compilerOptions.noEmitOnError` to decide whether type errors should fail the build. If you want to override that behavior for Vite, pass a `typeCheck` option to the framework helper:
155+
156+
```ts
157+
import { defineConfig } from 'vite';
158+
import { vueConfig } from '@nativescript/vite/vue';
159+
160+
export default defineConfig(({ mode }) =>
161+
vueConfig({ mode }, { typeCheck: 'warn' })
162+
);
163+
```
164+
165+
Supported values are `typeCheck: 'error' | 'warn' | 'off'`.
166+
You can also use an object form such as `typeCheck: { failOnError: false }`.
167+
For temporary overrides, `NS_VITE_TYPECHECK=warn` or `--env.typecheck=warn` will force warn mode for a run.
168+
If you want type errors to stay non-fatal without any Vite override, set `"noEmitOnError": false` in your project's `tsconfig.json`.
169+
152170
## Advanced: HMR update hooks
153171

154172
When using the HMR workflow (for example `npm run dev:ios` / `npm run dev:android` / `npm run dev:visionos`, etc.), you may want to run some custom logic after each HMR batch is applied on device.

0 commit comments

Comments
 (0)