Vite Plugin Neutralino
raw JSON → 1.0.3 verified Mon Apr 27 auth: no javascript
A Vite plugin (v1.0.3, stable) that seamlessly integrates Neutralinojs with Vite by automatically injecting the __neutralino_globals.js script into index.html. In development it discovers the Neutralinojs backend port from .tmp/auth_info.json and connects; in production it sets the correct script path. Zero-config, TypeScript types included, supports custom root paths. Differentiator: automatic port/connection handling compared to manual Neutralino integration.
Common errors
error Error: Cannot find module 'vite-plugin-neutralino' ↓
cause Package not installed or not in node_modules.
fix
Install: npm install vite-plugin-neutralino --save-dev
error SyntaxError: The requested module 'vite-plugin-neutralino' does not provide an export named 'neutralino' ↓
cause Using named import instead of default import.
fix
Change to: import neutralino from 'vite-plugin-neutralino'
error TypeError: neutralino is not a function ↓
cause Imported the wrong thing (e.g., options type instead of function).
fix
Ensure you import the default export, not a named export.
Warnings
gotcha neutralino() must be called without options or with an object — passing wrong argument type will throw. ↓
fix Call as neutralino() or neutralino({ rootPath: 'path' }).
gotcha In dev mode, the Neutralinojs app must be running before or simultaneously with Vite — plugin reads .tmp/auth_info.json. ↓
fix Start Neutralinojs first (neu run) then Vite dev, or use a concurrent runner.
gotcha The plugin only injects the script tag — it does not polyfill Neutralino global; your app still needs Neutralino runtime. ↓
fix Ensure Neutralinojs is properly installed and run in the expected environment.
deprecated No deprecated features known. ↓
fix N/A
Install
npm install vite-plugin-neutralino yarn add vite-plugin-neutralino pnpm add vite-plugin-neutralino Imports
- default (neutralino) wrong
import { neutralino } from 'vite-plugin-neutralino'correctimport neutralino from 'vite-plugin-neutralino' - NeutralinoPluginOptions wrong
import { NeutralinoPluginOptions } from 'vite-plugin-neutralino'correctimport type { NeutralinoPluginOptions } from 'vite-plugin-neutralino' - require wrong
const { neutralino } = require('vite-plugin-neutralino')correctconst neutralino = require('vite-plugin-neutralino')
Quickstart
// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import neutralino from 'vite-plugin-neutralino';
export default defineConfig({
plugins: [
vue(),
neutralino() // or neutralino({ rootPath: '../my-neutralino-app' })
]
});