Vite Plugin DLight Server

raw JSON →
0.9.21 verified Fri May 01 auth: no javascript

Vite plugin that transpiles DLight.js JSX-like syntax for server-side rendering, enabling DLight components to be used in Vite-based projects. Current stable version is 0.9.21, with weekly releases. Integrates seamlessly with Vite's build pipeline, handling DLight template compilation and HMR. Key differentiator: provides server-side rendering support for DLight, complementing the client-side @dl-light/dlight plugin.

error Error: The plugin 'vite-plugin-dlight-server' requires Vite 4 or higher.
cause Project uses Vite 3 which is incompatible with plugin version 0.9.0+.
fix
Upgrade Vite: npm install vite@latest
error TypeError: vitePluginDLightServer is not a function
cause Importing the plugin incorrectly due to ESM/CJS mismatch.
fix
Use ES6 import: import vitePluginDLightServer from 'vite-plugin-dlight-server'
error Error: Cannot find module '@dl-light/dlight'
cause Missing dependency @dl-light/dlight which is required at runtime.
fix
Install the package: npm install @dl-light/dlight
breaking Requires Vite 4+; incompatible with Vite 3.x.
fix Upgrade to Vite 4 or 5.
breaking Dropped support for Node.js 14; now requires Node 16+.
fix Update to Node 16 or higher.
gotcha The plugin must be placed before @dl-light/dlight in the plugins array.
fix Reorder plugins: vitePluginDLightServer() first, then dlight().
deprecated The 'server' option is deprecated; use 'ssr' option instead.
fix Replace server: true with ssr: true in plugin options.
npm install vite-plugin-dlight-server
yarn add vite-plugin-dlight-server
pnpm add vite-plugin-dlight-server

Shows how to add the DLight server plugin and client plugin to a Vite config.

import { defineConfig } from 'vite';
import vitePluginDLightServer from 'vite-plugin-dlight-server';
import dlight from '@dl-light/dlight';

export default defineConfig({
  plugins: [
    vitePluginDLightServer(),
    dlight()
  ]
});