Registry / devops / lc-bun-plugin

lc-bun-plugin

JSON →
library0.0.6jsnpmunverified

A collection of Bun bundler plugins for compiling Less stylesheets, importing SVG as raw strings, and generating HTML templates for multi-entry builds. The current stable version is 0.0.6. Release cadence is low (few commits). Key differentiators: simple integration with Bun's build pipeline, supports source maps for Less, and allows HTML template injection with bundle outputs. Suitable for small to medium projects using Bun as the bundler.

npm install lc-bun-plugin
INSTALL
IMPORT
SIG · LC-BUN-PLUGIN
L
lc-bun-plugin
devopsjavascriptv0.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

bunPluginLess
import { bunPluginLess } from 'lc-bun-plugin'
const bunPluginLess = require('lc-bun-plugin')
ESM-only; no CommonJS support. The package exports named functions.
bunPluginHtml
import { bunPluginHtml } from 'lc-bun-plugin'
import bunPluginHtml from 'lc-bun-plugin'
Must be called after Bun.build(); expects outputs and buildConfig from build results.
bunPluginSvg
import { bunPluginSvg } from 'lc-bun-plugin'
No wrong pattern commonly seen.

Demonstrates how to use all three plugins: compile Less, inline SVG imports, and inject bundle paths into an HTML template.

import { bunPluginLess, bunPluginHtml, bunPluginSvg } from 'lc-bun-plugin'; import path from 'path'; async function main() { const lessPlugin = bunPluginLess({ sourceMap: { sourceMapFileInline: true }, }); const buildConfig = { entrypoints: ['./src/index.mjs'], outdir: './dist', plugins: [lessPlugin, bunPluginSvg()], }; const { outputs } = await Bun.build(buildConfig); // Only call bunPluginHtml after build bunPluginHtml({ templatePath: path.join(process.cwd(), 'template.html'), outputs, buildConfig, }); } main();
Debug
Known issues
gotchabunPluginHtml must be called after Bun.build() and relies on outputs and buildConfig arguments.
fix
Ensure you call bunPluginHtml only after awaiting Bun.build() and pass the returned outputs and your buildConfig object.
affects: >=0.0.1
gotchabunPluginLess requires the less package to be installed as a peer dependency.
fix
Run 'npm install less' or 'yarn add less' in your project.
affects: >=0.0.1
gotchabunPluginHtml does not support .html files as entry points; use .js, .mjs, etc.
fix
Use JavaScript-based entry points and inject HTML via the plugin.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: bunPluginLess is not a function
Incorrect import: using default import instead of named import.
fix
Use import { bunPluginLess } from 'lc-bun-plugin' instead of import bunPluginLess from 'lc-bun-plugin'.
error: Cannot find module 'less'
Missing peer dependency 'less' required by bunPluginLess.
fix
Install less: npm install less
Error: bunPluginHtml must be called after Bun.build()
bunPluginHtml was called before or without Bun.build() results.
fix
Call bunPluginHtml inside the async function after awaiting Bun.build() and pass outputs and buildConfig.
Upgrade
Version history
0.0.6latest on npm
Audit
Dependencies
lessrequiredRequired by bunPluginLess to compile Less files
bun-typesoptionalType definitions for Bun APIs (outputs, build config)
Agent activity
10 hits · last 30 days
node
6
Bingbot
1
Resources
lc-bun-plugin — npm install lc-bun-plugin · libregistry