Registry / devops / hexo-esbuild

hexo-esbuild

JSON →
library2.0.0jsnpmunverified

Hexo plugin to transform JavaScript, CSS, TypeScript, and JSX files using esbuild's transform API. Current stable version is 2.0.0, with major version bumps aligning with esbuild updates (e.g., esbuild 0.25.0). Key differentiators: integrates esbuild into Hexo's filter system, supports per-type configuration (JS, CSS, TS, JSX), micromatch-based exclusion, and configurable priority. Actively maintained by uiolee with regular releases via changesets. Compared to alternatives (hexo-optimize, hexo-babel), hexo-esbuild leverages esbuild for fast, minimal transforms.

npm install hexo-esbuild
INSTALL
IMPORT
SIG · HEXO-ESBUILD
H
hexo-esbuild
devopsjavascriptv2.0.0
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.

hexo-esbuild
import hexoEsbuild from 'hexo-esbuild';
const hexoEsbuild = require('hexo-esbuild');
Package is ESM-only as of v2.0.0. Use import syntax in ES modules context.
HexoEsbuildConfig
import type { HexoEsbuildConfig } from 'hexo-esbuild';
TypeScript users can import the config type for type-safe configuration.
defaultConfig
import { defaultConfig } from 'hexo-esbuild';
Named export of the default configuration object. Available since v1.0.0.

Basic configuration to enable JavaScript and CSS minification via esbuild in Hexo.

// hexo/_config.yml hexo_esbuild: enable: true js: esbuildTransformOptions: loader: 'js' minify: true css: esbuildTransformOptions: loader: 'css' minify: true
Debug
Known issues
breakingv2.0.0 requires esbuild >=0.25.0 (was ^0.25.0). Projects with older esbuild versions will break.
fix
Update esbuild to ^0.25.0: npm install esbuild@latest
affects: <2.0.0
gotchaPackage is ESM-only since v2.0.0. require() will fail if not using ESM.
fix
Use import syntax and ensure your project is ESM-compatible (module in package.json, .mjs extension).
affects: >=2.0.0
gotchaConfiguration must be placed under 'hexo_esbuild' key in _config.yml – common mistake to put it at root.
fix
Ensure config namespace matches: hexo_esbuild: ...
affects: >=1.0.0
gotchaExclude patterns are passed to micromatch – glob patterns are not always compatible with minimatch. Wrong patterns may silently ignore files.
fix
Use micromatch-compatible glob patterns (e.g., '**.min.js' not '**/*.min.js').
affects: >=1.0.0
deprecatedThe 'minify' option inside esbuildTransformOptions may be overridden by esbuild's own minification settings in future versions.
fix
Set minify explicitly: true or false as needed.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'hexo-esbuild'
Package not installed or wrong import path.
fix
Run: npm install hexo-esbuild, then import using 'hexo-esbuild' (not './hexo-esbuild').
TypeError: hexoEsbuild is not a function
Using require() with ESM-only package (v2.0.0+).
fix
Use import syntax: import hexoEsbuild from 'hexo-esbuild'; Or downgrade to v1.x.
Invalid configuration key: hexo_esbuild
Misplaced config in _config.yml (e.g., nested under another key).
fix
Ensure 'hexo_esbuild' is a top-level key in _config.yml.
esbuild: unexpected argument '0.25.0'
Incompatible esbuild version installed (requires ^0.25.0).
fix
Install esbuild version matching peer dependency: npm install esbuild@^0.25.0
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
esbuildrequiredPeer dependency - required to run esbuild's transform API
micromatchrequiredPeer dependency - used for file pattern matching (exclude lists)
Agent activity
6 hits · last 30 days
node
6
Resources
hexo-esbuild — npm install hexo-esbuild · libregistry