Haya: ESBuild Dev Server & Bundler
Haya is an experimental development server and production bundler leveraging `esbuild` for both development and build processes, in contrast to similar tools like Vite which utilize Rollup for production builds. Currently at version `0.0.10`, it is in a very early stage of development and explicitly not recommended for serious production projects. Its release cadence appears rapid, with frequent minor version updates introducing features like Vue support and asset handling (e.g., `?raw`, `?worker`). Key differentiators include its `esbuild`-only approach for bundling, which aims for potentially faster production builds, and a reliance on full-page reloads during development instead of fine-grained Hot Module Replacement (HMR). It provides out-of-the-box support for TypeScript, JSX/TSX, CSS, and PostCSS, with path alias configuration available via `tsconfig.json`.
Common errors
-
Error: `haya` requires Node.js version >=16. Current version is X.
cause The installed Node.js version does not meet Haya's minimum requirement of Node.js 16 or higher.fixUpgrade your Node.js environment to version 16 or newer using a tool like `nvm` or by installing a recent Node.js distribution. -
Cannot find module '@vue/compiler-sfc' or its corresponding type declarations.
cause Attempting to use Vue components without the required peer dependency `@vue/compiler-sfc` installed.fixInstall the Vue compiler: `npm install @vue/compiler-sfc`. -
Error: Cannot find module 'postcss'
cause A `postcss.config.js` or `postcss.config.cjs` file exists, but PostCSS itself is not installed.fixInstall PostCSS as a dev dependency: `npm install postcss -D`.
Warnings
- gotcha Haya is in a very early stage of development (current version 0.0.10) and is explicitly not recommended for serious projects. Features and APIs may be unstable.
- gotcha Haya currently only supports full page reloading during development, lacking fine-grained Hot Module Replacement (HMR) for JavaScript files.
- breaking As a pre-1.0 package, Haya's APIs and internal mechanisms are subject to frequent breaking changes without major version increments.
- gotcha Vue Single File Component (SFC) support requires `@vue/compiler-sfc` as a peer dependency, which must be installed manually.
Install
-
npm install haya -
yarn add haya -
pnpm add haya
Imports
- createServer
const { createServer } = require('haya')import { createServer } from 'haya' - build
import build from 'haya/build'
import { build } from 'haya' - preview
const preview = require('haya').previewimport { preview } from 'haya'
Quickstart
npx aho@latest egoist/haya/template my-app cd my-app npm install # Start development server npm run dev # Build for production npm run build # Preview production build npm run preview