layabox-esbuild

raw JSON →
1.3.2 verified Fri May 01 auth: no javascript

A build tool that uses esbuild to incrementally build LayaBox projects, enabling near-instant browser refresh after code changes. Version 1.3.2 is the current stable release. It is distributed as a CLI tool (globally installed via npm) and provides commands to initialize config, start build server, and specify custom config files. Key differentiators: it does not compile TypeScript but uses esbuild for fast bundling, supports breakpoint debugging (VSCode or browser), and includes a built-in WebSocket tool for live reload. Compared to LayaAir's built-in compiler or webpack, it offers significantly faster rebuild times. The tool is designed specifically for LayaBox game development workflow.

error command not found: layabox-esbuild
cause Package not installed globally or not in PATH.
fix
Run npm i layabox-esbuild -g
error Error: Cannot find module './layaboxEsbuildConfig.js'
cause Config file missing or wrong path.
fix
Run 'layabox-esbuild -i' to generate default config, then ensure it's in the current directory.
error TypeError: Cannot read properties of undefined (reading 'port')
cause Config object is empty or missing required fields.
fix
Check that layaboxEsbuildConfig.js exports a valid configuration object.
gotcha Must install globally with -g flag, otherwise CLI commands won't be found.
fix npm i layabox-esbuild -g
gotcha Config file path must match the -c argument; default expects layaboxEsbuildConfig.js in cwd.
fix Ensure config file exists at specified path or run -i to generate default.
gotcha The tool does not compile TypeScript; it only proxies files. Make sure your browser supports ES modules or use a bundler for production.
fix Use a separate build step for production, e.g., esbuild or webpack.
gotcha Auto-update task time is in minutes, not seconds. Setting too low may cause high CPU usage.
fix Set autoUpdateTaskTime to a reasonable value (default is 5).
npm install layabox-esbuild
yarn add layabox-esbuild
pnpm add layabox-esbuild

Globally install the package, initialize a config file, then start the development server with watch mode.

npm i layabox-esbuild -g
# Then in project root:
layabox-esbuild -i
layabox-esbuild -s