{"id":22933,"library":"vite-plugin-with-nitro","title":"vite-plugin-with-nitro","description":"A Vite plugin that adds a Nitro API server to your Vite project, forked from @analogjs/vite-plugin-nitro. Current version 0.0.5 is experimental. Use it to develop and build an API server with Nitro (UnJS) alongside your Vite frontend. Differs from the analogjs fork by being standalone without AnalogJS dependencies. Requires Node >=20 and Vite 5. Release cadence is low; the package is in early stages.","status":"active","version":"0.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/ouronxing/vite-plugin-with-nitro","tags":["javascript","vite","plugin-vite","nitro","typescript"],"install":[{"cmd":"npm install vite-plugin-with-nitro","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-with-nitro","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-with-nitro","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is ESM-only, CommonJS require will fail.","wrong":"const nitro = require('vite-plugin-with-nitro')","symbol":"default","correct":"import nitro from 'vite-plugin-with-nitro'"},{"note":"Not a typical import; the default export is the recommended way.","wrong":"","symbol":"VitePluginWithNitro","correct":"import { VitePluginWithNitro } from 'vite-plugin-with-nitro'"},{"note":"NitroOptions is a TypeScript type, should be imported with `import type` to avoid runtime errors.","wrong":"import { NitroOptions } from 'vite-plugin-with-nitro'","symbol":"NitroOptions","correct":"import type { NitroOptions } from 'vite-plugin-with-nitro'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite'\nimport nitro from 'vite-plugin-with-nitro'\n\nexport default defineConfig({\n  plugins: [\n    nitro({\n      // Nitro options\n      preset: 'node-server',\n      // Optional: customize API directory\n      apiDir: '.nitro/api',\n    }),\n  ],\n})","lang":"typescript","description":"Basic setup: add the nitro plugin to Vite config with optional Nitro preset and API directory."},"warnings":[{"fix":"Upgrade Node.js to version 20 or higher.","message":"Forced Node.js version requirement >=20.0.0","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use import syntax or configure your project to use ESM.","message":"The plugin is ESM-only; using require() will fail with a runtime error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check the documentation for any changes if migrating from the analogjs fork.","message":"Forked from @analogjs/vite-plugin-nitro; API may differ from the original.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin to exact version or expect breaking changes on minor/patch updates.","message":"Package is at version 0.0.5 — very early stage, breaking changes may occur.","severity":"deprecated","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `pnpm add vite-plugin-with-nitro -S`","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'vite-plugin-with-nitro'"},{"fix":"Upgrade Node.js to version 20 or higher.","cause":"Node.js version is too low.","error":"Error: The plugin 'vite-plugin-with-nitro' requires Node.js >=20.0.0"},{"fix":"Add \"type\": \"module\" to package.json or rename file to .mjs.","cause":"The project is not configured as ESM and you are using import syntax.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}