{"id":25724,"library":"hexo-esbuild","title":"hexo-esbuild","description":"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.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/uiolee/hexo-plugin","tags":["javascript","hexo","hexo-plugin","plugin","esbuild","minify","typescript"],"install":[{"cmd":"npm install hexo-esbuild","lang":"bash","label":"npm"},{"cmd":"yarn add hexo-esbuild","lang":"bash","label":"yarn"},{"cmd":"pnpm add hexo-esbuild","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency - required to run esbuild's transform API","package":"esbuild","optional":false},{"reason":"Peer dependency - used for file pattern matching (exclude lists)","package":"micromatch","optional":false}],"imports":[{"note":"Package is ESM-only as of v2.0.0. Use import syntax in ES modules context.","wrong":"const hexoEsbuild = require('hexo-esbuild');","symbol":"hexo-esbuild","correct":"import hexoEsbuild from 'hexo-esbuild';"},{"note":"TypeScript users can import the config type for type-safe configuration.","symbol":"HexoEsbuildConfig","correct":"import type { HexoEsbuildConfig } from 'hexo-esbuild';"},{"note":"Named export of the default configuration object. Available since v1.0.0.","symbol":"defaultConfig","correct":"import { defaultConfig } from 'hexo-esbuild';"}],"quickstart":{"code":"// hexo/_config.yml\nhexo_esbuild:\n  enable: true\n  js:\n    esbuildTransformOptions:\n      loader: 'js'\n      minify: true\n  css:\n    esbuildTransformOptions:\n      loader: 'css'\n      minify: true","lang":"yaml","description":"Basic configuration to enable JavaScript and CSS minification via esbuild in Hexo."},"warnings":[{"fix":"Update esbuild to ^0.25.0: npm install esbuild@latest","message":"v2.0.0 requires esbuild >=0.25.0 (was ^0.25.0). Projects with older esbuild versions will break.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use import syntax and ensure your project is ESM-compatible (module in package.json, .mjs extension).","message":"Package is ESM-only since v2.0.0. require() will fail if not using ESM.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure config namespace matches: hexo_esbuild: ...","message":"Configuration must be placed under 'hexo_esbuild' key in _config.yml – common mistake to put it at root.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use micromatch-compatible glob patterns (e.g., '**.min.js' not '**/*.min.js').","message":"Exclude patterns are passed to micromatch – glob patterns are not always compatible with minimatch. Wrong patterns may silently ignore files.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set minify explicitly: true or false as needed.","message":"The 'minify' option inside esbuildTransformOptions may be overridden by esbuild's own minification settings in future versions.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: npm install hexo-esbuild, then import using 'hexo-esbuild' (not './hexo-esbuild').","cause":"Package not installed or wrong import path.","error":"Error: Cannot find module 'hexo-esbuild'"},{"fix":"Use import syntax: import hexoEsbuild from 'hexo-esbuild'; Or downgrade to v1.x.","cause":"Using require() with ESM-only package (v2.0.0+).","error":"TypeError: hexoEsbuild is not a function"},{"fix":"Ensure 'hexo_esbuild' is a top-level key in _config.yml.","cause":"Misplaced config in _config.yml (e.g., nested under another key).","error":"Invalid configuration key: hexo_esbuild"},{"fix":"Install esbuild version matching peer dependency: npm install esbuild@^0.25.0","cause":"Incompatible esbuild version installed (requires ^0.25.0).","error":"esbuild: unexpected argument '0.25.0'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}