New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@nativescript/vite

Package Overview
Dependencies
Maintainers
2
Versions
165
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nativescript/vite

Vite for NativeScript

Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
4.5K
17.19%
Maintainers
2
Weekly downloads
 
Created
Source

@nativescript/vite

Vite bundler integration for NativeScript apps. Provides a minimal setup for fast dev and build.

Prerequisites

  • NativeScript 9 or higher

Install

npm i @nativescript/vite -D

Quick start (init)

To bootstrap an existing NativeScript app for Vite, run from your app root:

npx nativescript-vite init

This will:

  • Generate a vite.config.ts using the detected project flavor (Angular, Vue, React, Solid, TypeScript, or JavaScript) and the corresponding helper from @nativescript/vite.
  • Add (or update) the following npm scripts in your app package.json:
    • dev:ios
    • dev:android
    • dev:server:ios
    • dev:server:android
    • ios
    • android
  • Add the devDependencies concurrently and wait-on.
  • Add the dependency @valor/nativescript-websockets.
  • Append .ns-vite-build to .gitignore if it is not already present.

After running init, you now have two ways to work with Vite:

  • HMR workflow
npm run dev:ios
  • Standard dev workflow (non-HMR)
ns debug ios --no-hmr
ns debug android --no-hmr

Usage

  • Create vite.config.ts:
import { defineConfig, mergeConfig, UserConfig } from 'vite';
import { typescriptConfig } from '@nativescript/vite';

export default defineConfig(({ mode }): UserConfig => {
	return mergeConfig(typescriptConfig({ mode }), {});
});
  • Update nativescript.config.ts:
import { NativeScriptConfig } from '@nativescript/core';

export default {
	// add these:
	bundler: 'vite',
	bundlerConfigPath: 'vite.config.ts',
} as NativeScriptConfig;
  • Enjoy Vite.

Explore More

Check out the NativeScript Vite documentation for more configuration options and features.

Keywords

nativescript

FAQs

Package last updated on 17 Nov 2025

Related posts