Vite Plugin DLight Transpiler
raw JSON → 0.6.1 verified Fri May 01 auth: no javascript
A Vite plugin that transpiles DLight.js components at build time. Current stable version: 0.6.1. This plugin is a core part of the DLight.js ecosystem, providing the necessary compilation step for DLight's JSX-like syntax. It integrates with Vite's build pipeline to transform .dlight files into JavaScript. Release cadence is sporadic, tied to DLight.js updates. Key differentiator: it enables the use of DLight.js with Vite, which is faster and more modern than webpack-based alternatives.
Common errors
error Error: Cannot find module 'vite-plugin-dlight-transpiler' ↓
cause Missing npm install of the package.
fix
Run: npm install vite-plugin-dlight-transpiler
error TypeError: dlightTranspiler is not a function ↓
cause Using named import instead of default import.
fix
Change import statement to: import dlightTranspiler from 'vite-plugin-dlight-transpiler'
error Error: Plugin dlight-transpiler: unknown option 'foo' ↓
cause Passing an unsupported option in the plugin config.
fix
Check the available options (include, exclude) and correct the configuration.
Warnings
breaking Version 0.5.0 changed the plugin API from named export to default export. Old imports will break. ↓
fix Update import to default import: import dlightTranspiler from 'vite-plugin-dlight-transpiler'
deprecated The options argument signature changed in v0.6.0. Old options format will log a deprecation warning. ↓
fix Use new options shape: { include: string[], exclude: string[], ... }
gotcha The plugin must be placed before other transform plugins in the Vite plugin array to ensure source files are transpiled first. ↓
fix Add the plugin as the first element in the plugins array.
Install
npm install vite-plugin-dlight-transpiler yarn add vite-plugin-dlight-transpiler pnpm add vite-plugin-dlight-transpiler Imports
- default wrong
import { dlightTranspiler } from 'vite-plugin-dlight-transpiler'correctimport dlightTranspiler from 'vite-plugin-dlight-transpiler' - dlightTranspiler wrong
const { dlightTranspiler } = require('vite-plugin-dlight-transpiler')correctconst dlightTranspiler = require('vite-plugin-dlight-transpiler') - DLightTranspilerOptions
import type { DLightTranspilerOptions } from 'vite-plugin-dlight-transpiler'
Quickstart
// vite.config.js
import { defineConfig } from 'vite'
import dlightTranspiler from 'vite-plugin-dlight-transpiler'
export default defineConfig({
plugins: [dlightTranspiler()]
})