vite-plugin-pawajs
raw JSON → 0.0.4 verified Fri May 01 auth: no javascript
A Vite plugin for PawaJS component files that ensures minifier-safe return statements and injects automatic component names. Current version 0.0.4, actively maintained. Uses estree-walker and magic-string for AST transforms. Works with JavaScript and TypeScript. Differentiates by specifically targeting PawaJS framework, unlike general-purpose Vite plugins.
Common errors
error Cannot read properties of undefined (reading 'length') ↓
cause Plugin may fail if input file is empty or has no component registration.
fix
Ensure .pawa files contain at least one component export or non-empty source.
error Error: Could not source map for ... ↓
cause Magic-string source map generation might conflict if other plugins also manipulate the same file.
fix
Reorder plugins: pawajsPlugin before other transform plugins.
error SyntaxError: Unexpected token ↓
cause PawaJS files contain syntax not yet supported by estree-walker or Vite parser.
fix
Check that your .pawa file uses valid PawaJS syntax; avoid experimental ECMAScript features.
Warnings
gotcha Plugin only transforms files with .pawa extension. Other files are ignored. ↓
fix Ensure your PawaJS component files have .pawa extension.
breaking Version 0.0.4 may have breaking changes from earlier versions due to early development stage. ↓
fix Check release notes and update your config as needed.
deprecated The plugin is still in early development; APIs may change without major version bump. ↓
fix Lock your dependency version and monitor changelog.
Install
npm install pawajs-vite-plugin yarn add pawajs-vite-plugin pnpm add pawajs-vite-plugin Imports
- pawajsPlugin wrong
import pawajsPlugin from 'vite-plugin-pawajs'correctimport { pawajsPlugin } from 'vite-plugin-pawajs' - pawajsPlugin wrong
const pawajsPlugin = require('vite-plugin-pawajs');correctconst { pawajsPlugin } = require('vite-plugin-pawajs'); - pawajsPlugin wrong
import pawajsPlugin from 'vite-plugin-pawajs';correct// In vite.config.ts import { pawajsPlugin } from 'vite-plugin-pawajs'
Quickstart
// vite.config.ts
import { defineConfig } from 'vite';
import { pawajsPlugin } from 'vite-plugin-pawajs';
export default defineConfig({
plugins: [pawajsPlugin()]
});
// Then use .pawa files in your project