{"id":21695,"library":"piral-cli-vite","title":"Piral CLI Vite","description":"Plugin for Piral CLI that enables using Vite as the bundler for Piral instances and pilets. Current stable version is 1.4.0, released with provenance support. Releases are frequent with bug fixes and feature additions. Key differentiator: batteries-included approach with built-in vite-plugin-codegen and vite-plugin-environment, no need to install Vite separately. Handles assets, stylesheets (CSS, SASS), and TypeScript out of the box. Supports custom Vite config via vite.config.js/ts.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/smapiot/piral-cli-vite","tags":["javascript","piral-cli","piral","plugin","vite","build","debug","bundle","typescript"],"install":[{"cmd":"npm install piral-cli-vite","lang":"bash","label":"npm"},{"cmd":"yarn add piral-cli-vite","lang":"bash","label":"yarn"},{"cmd":"pnpm add piral-cli-vite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for code generation during bundling","package":"vite-plugin-codegen","optional":false},{"reason":"Provides automatic exposure of environment variables like process.env.NODE_ENV","package":"vite-plugin-environment","optional":false}],"imports":[{"note":"Plugin is ESM-only since v1.2.0; CommonJS require not supported for the main import.","wrong":"const piralCliVite = require('piral-cli-vite')","symbol":"default","correct":"import piralCliVite from 'piral-cli-vite'"},{"note":"Named export for the plugin class or function. Path imports like '/lib/index' are incorrect.","wrong":"import { PiralCliVitePlugin } from 'piral-cli-vite/lib/index'","symbol":"PiralCliVitePlugin","correct":"import { PiralCliVitePlugin } from 'piral-cli-vite'"},{"note":"createViteConfig is a named export, not default.","wrong":"import createViteConfig from 'piral-cli-vite'","symbol":"createViteConfig","correct":"import { createViteConfig } from 'piral-cli-vite'"}],"quickstart":{"code":"// Install: npm i piral-cli-vite --save-dev\n\n// No code needed in your project; standard Piral commands will leverage Vite automatically.\n// Example: build a Piral instance\n// piral build\n\n// Example: debug a pilet\n// pilet debug\n\n// For custom Vite config, create vite.config.js:\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  plugins: [\n    // your custom plugins here\n  ],\n});","lang":"javascript","description":"Shows installation and usage of piral-cli-vite as a Piral CLI plugin: install, then use standard piral/pilet commands. Optionally add custom Vite config."},"warnings":[{"fix":"Use import syntax or switch to CommonJS-compatible version ≤1.1.1.","message":"Since v1.2.0, the plugin is ESM-only. Using require() will fail with an error.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Update to latest version: npm install piral-cli-vite@latest","message":"v1.0.x versions are deprecated; upgrade to at least v1.1.0 for pilet schema v3 support and standard vite.config.js support.","severity":"deprecated","affected_versions":"<1.1.0"},{"fix":"Either place your public assets in src/public or set a custom publicDir in vite.config.js.","message":"The plugin automatically sets the source folder (e.g., /src) as root. If you have a public folder, use src/public, not /public. Customize via vite.config.js publicDir.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add async, defer, or blocking attribute to scripts that should not be bundled.","message":"Scripts with type=module in index.html are treated as entry points by Vite. The plugin patches index.html to avoid breaking, but explicit non-bundled scripts need attributes like async/defer/blocking.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove or rename extra vite.config.js files; the plugin will pick up the one in the root.","message":"If a vite.config.js exists in the execution root, it will be used. Double usage was fixed in v1.0.2, but ensure you don't have conflicting configs.","severity":"gotcha","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: npm install piral-cli-vite --save-dev","cause":"Plugin not installed or not in node_modules.","error":"Error: Cannot find module 'piral-cli-vite'"},{"fix":"Use ES module import syntax, or downgrade to v1.1.1.","cause":"Using CommonJS require with an ESM-only plugin (v1.2.0+).","error":"TypeError: piral_cli_vite_1.default is not a function"},{"fix":"Ensure you have installed piral-cli-vite correctly; it includes Vite internally. If you have a global Vite, remove it or align versions.","cause":"Missing Vite dependency; plugin expects vite to be available but it bundles its own internally.","error":"Error: The 'vite' package is not installed or configuration is invalid."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}