npm.io
0.8.0 • Published yesterday

@palamedes/vite-plugin

Licence
MIT
Version
0.8.0
Deps
4
Size
21 kB
Vulns
0
Weekly
1.3K

@palamedes/vite-plugin

npm version CI Sponsored by Sebastian Software License: MIT

The recommended Palamedes entry point for Vite applications.

@palamedes/vite-plugin gives Vite projects fast macro transforms, .po loading, and a translation workflow that feels native to modern frontend tooling instead of bolted on from an older Babel path.

Status

  • Recommended for Vite projects using React or Solid and Palamedes macros
  • Supports .po imports and source-string-first catalog semantics
  • Reports missing translations and ICU compatibility diagnostics during builds
  • Best paired with @palamedes/runtime and @palamedes/cli
  • Not a framework generator or top-level app scaffold

Start Here

Use the full copy-paste setup guide:

Installation

pnpm add @palamedes/core @palamedes/runtime @palamedes/vite-plugin
pnpm add -D @palamedes/cli @palamedes/config

Then add the host package pair you want:

pnpm add @palamedes/react react react-dom
pnpm add -D @vitejs/plugin-react

or

pnpm add @palamedes/solid solid-js
pnpm add -D vite-plugin-solid

Minimal Setup

import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
import { palamedes } from "@palamedes/vite-plugin"

export default defineConfig({
  plugins: [palamedes(), react()],
})
import { defineConfig } from "vite"
import solid from "vite-plugin-solid"
import { palamedes } from "@palamedes/vite-plugin"

export default defineConfig({
  plugins: [palamedes(), solid()],
})
import { defineConfig } from "@palamedes/config"

export default defineConfig({
  locales: ["en", "de"],
  sourceLocale: "en",
  catalogs: [
    {
      path: "src/locales/{locale}",
      include: ["src"],
    },
  ],
})

Transformed code expects getI18n() from @palamedes/runtime, so register the active client i18n instance before translated code executes.

Options

import { palamedes } from "@palamedes/vite-plugin"

palamedes({
  include: /\.(tsx?|jsx?|mjs|cjs)$/,
  exclude: /node_modules/,
  enablePoLoader: true,
  configPath: "./palamedes.config.ts",
  failOnMissing: false,
  failOnCompileError: false,
  runtimeModule: "@palamedes/runtime",
})

What This Package Handles

  • transforms supported message macros before the rest of the Vite pipeline runs
  • compiles imported .po files into JavaScript modules
  • keeps source-string-first catalog semantics aligned with the native core
  • reports common macro, catalog, placeholder, and ICU compatibility issues during dev and build

License

Sebastian Software

MIT 2026 Sebastian Software

Keywords