Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

esbuildesbuild 搜索

Agent Skill

esbuild 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

564

周安装

24

GitHub Stars

12

下载量

198
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:esbuild(esbuild 搜索)
来源仓库:https://github.com/claude-dev-suite/claude-dev-suite
仓库路径:skills/esbuild
安装命令:
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill esbuild
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill esbuild

简介

esbuild 是极速的 JavaScript/TypeScript 打包工具,由 Go 语言编写实现高性能。

  • 适用于简单库打包、理解 Vite 内部机制或定制构建脚本等轻量场景。
  • 不支持复杂插件生态、CSS 处理或热更新,此时应选用 Vite 或 Webpack。
  • 可通过 CLI 直接调用,支持单文件打包与多入口配置,学习曲线平缓。
  • esbuild 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

esbuild - Quick Reference

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: esbuild for comprehensive documentation.

When NOT to Use This Skill

  • Complex applications - Use Vite (which uses esbuild internally)
  • Need many plugins - Webpack or Rollup have richer ecosystems
  • CSS modules, PostCSS - Vite handles these better
  • HMR required - Vite provides full HMR experience

When to Use This Skill

  • Ultra-fast simple bundling
  • TypeScript library builds
  • Understanding how Vite works
  • Custom build scripts

Setup

npm install -D esbuild

CLI Usage

# Bundle single file
esbuild src/index.ts --bundle --outfile=dist/bundle.js

# Watch mode
esbuild src/index.ts --bundle --outfile=dist/bundle.js --watch

# Minify for production
esbuild src/index.ts --bundle --minify --outfile=dist/bundle.min.js

# Multiple outputs
esbuild src/index.ts --bundle --outdir=dist --format=esm --format=cjs

# Source maps
esbuild src/index.ts --bundle --sourcemap --outfile=dist/bundle.js

API Usage

// build.ts
import * as esbuild from 'esbuild';

// Simple build
await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  outfile: 'dist/bundle.js',
});

// Production build
await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  minify: true,
  sourcemap: true,
  target: ['es2020'],
  outfile: 'dist/bundle.min.js',
});

Configuration Options

await esbuild.build({
  // Entry points
  entryPoints: ['src/index.ts', 'src/worker.ts'],
  // Or object for custom names
  entryPoints: {
    main: 'src/index.ts',
    worker: 'src/worker.ts',
  },

  // Output
  bundle: true,
  outdir: 'dist',
  outfile: 'dist/bundle.js',    // Single file
  outExtension: { '.js': '.mjs' },

  // Format
  format: 'esm',   // 'esm' | 'cjs' | 'iife'
  platform: 'node', // 'browser' | 'node' | 'neutral'
  target: ['es2020', 'chrome90', 'firefox88'],

  // Optimization
  minify: true,
  minifyWhitespace: true,
  minifyIdentifiers: true,
  minifySyntax: true,
  treeShaking: true,

  // Source maps
  sourcemap: true,        // External .map file
  sourcemap: 'inline',    // Inline in JS
  sourcemap: 'linked',    // External with reference

  // Splitting (ESM only)
  splitting: true,
  chunkNames: 'chunks/[name]-[hash]',

  // External packages
  external: ['react', 'react-dom'],
  packages: 'external',   // All node_modules external

  // Define
  define: {
    'process.env.NODE_ENV': '"production"',
    '__VERSION__': '"1.0.0"',
  },

  // Loaders
  loader: {
    '.png': 'file',
    '.svg': 'text',
    '.json': 'json',
  },

  // Paths
  alias: {
    '@': './src',
    '@components': './src/components',
  },
  resolveExtensions: ['.tsx', '.ts', '.jsx', '.js'],

  // Banner/Footer
  banner: {
    js: '/* Bundle generated at ' + new Date().toISOString() + ' */',
  },
  footer: {
    js: '/* End of bundle */',
  },

  // Legal comments
  legalComments: 'none', // 'none' | 'inline' | 'eof' | 'linked' | 'external'

  // Metafile for analysis
  metafile: true,
});

Watch Mode (API)

// Watch with rebuild
const ctx = await esbuild.context({
  entryPoints: ['src/index.ts'],
  bundle: true,
  outfile: 'dist/bundle.js',
});

await ctx.watch();
console.log('Watching for changes...');

// Later: stop watching
await ctx.dispose();

Dev Server

const ctx = await esbuild.context({
  entryPoints: ['src/index.tsx'],
  bundle: true,
  outdir: 'dist',
});

// Start dev server
await ctx.serve({
  servedir: 'dist',
  port: 3000,
});

console.log('Server running on http://localhost:3000');

Plugins

// Custom plugin structure
const myPlugin: esbuild.Plugin = {
  name: 'my-plugin',
  setup(build) {
    // Resolve hook
    build.onResolve({ filter: /^env$/ }, (args) => ({
      path: args.path,
      namespace: 'env-ns',
    }));

    // Load hook
    build.onLoad({ filter: /.*/, namespace: 'env-ns' }, () => ({
      contents: JSON.stringify(process.env),
      loader: 'json',
    }));

    // Start/End hooks
    build.onStart(() => {
      console.log('Build started');
    });

    build.onEnd((result) => {
      console.log(`Build ended with ${result.errors.length} errors`);
    });
  },
};

await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  plugins: [myPlugin],
  outfile: 'dist/bundle.js',
});

Common Plugins

// Environment variables plugin
const envPlugin: esbuild.Plugin = {
  name: 'env',
  setup(build) {
    build.onResolve({ filter: /^env$/ }, (args) => ({
      path: args.path,
      namespace: 'env-ns',
    }));

    build.onLoad({ filter: /.*/, namespace: 'env-ns' }, () => ({
      contents: `export const API_URL = ${JSON.stringify(process.env.API_URL)}`,
      loader: 'ts',
    }));
  },
};

// CSS modules plugin (basic)
const cssModulesPlugin: esbuild.Plugin = {
  name: 'css-modules',
  setup(build) {
    build.onLoad({ filter: /\.module\.css$/ }, async (args) => {
      const css = await fs.readFile(args.path, 'utf8');
      // Process CSS modules...
      return {
        contents: `export default ${JSON.stringify(classNames)}`,
        loader: 'js',
      };
    });
  },
};

Library Build

// Build library for npm
await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  minify: true,
  sourcemap: true,
  target: ['es2020'],
  external: ['react', 'react-dom'],  // Peer deps
  outdir: 'dist',
  format: 'esm',
  outExtension: { '.js': '.mjs' },
});

// Also build CJS
await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  minify: true,
  sourcemap: true,
  target: ['es2020'],
  external: ['react', 'react-dom'],
  outdir: 'dist',
  format: 'cjs',
  outExtension: { '.js': '.cjs' },
});
// package.json for library
{
  "name": "my-lib",
  "type": "module",
  "main": "./dist/index.cjs",
  "module": "./dist/index.mjs",
  "types": "./dist/index.d.ts",
  "exports": {
    ".": {
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs",
      "types": "./dist/index.d.ts"
    }
  }
}

Bundle Analysis

const result = await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  metafile: true,
  outfile: 'dist/bundle.js',
});

// Write metafile
await fs.writeFile('meta.json', JSON.stringify(result.metafile));

// Analyze
const analysis = await esbuild.analyzeMetafile(result.metafile);
console.log(analysis);

TypeScript Declaration

// esbuild doesn't generate .d.ts - use tsc
import { execSync } from 'child_process';

// Build JS with esbuild
await esbuild.build({
  entryPoints: ['src/index.ts'],
  bundle: true,
  outfile: 'dist/index.js',
});

// Generate types with tsc
execSync('tsc --emitDeclarationOnly --declaration --outDir dist');

Comparison with Other Bundlers

FeatureesbuildWebpackViteRollup
SpeedFastestSlowFast (uses esbuild)Medium
ConfigSimpleComplexSimpleMedium
PluginsLimitedManyManyMany
HMRBasicFullFullPlugin
Tree-shakingYesYesYesBest
Code-splittingESM onlyFullFullFull

When to Use esbuild

ScenarioRecommendation
Simple bundlingesbuild
Library buildesbuild + tsc
Complex appVite (uses esbuild)
Legacy supportWebpack
Need pluginsVite or Rollup

Anti-Patterns to Avoid

  • Do not use for complex apps (use Vite)
  • Do not expect advanced HMR
  • Do not forget tsc for.d.ts
  • Do not ignore external for libraries

Anti-Patterns

Anti-PatternWhy It's BadCorrect Approach
Using for complex appsMissing featuresUse Vite for apps, esbuild for libraries
Not externalizing dependenciesLarge library bundlesUse external: [...] for peer deps
No.d.ts generationMissing TypeScript typesRun tsc --emitDeclarationOnly
Expecting advanced HMResbuild HMR is basicUse Vite's dev server for HMR
Not specifying targetWrong output formatSet target: ['es2020'] explicitly
Missing bundle analysisUnknown bundle sizeUse metafile and analyzeMetafile

Quick Troubleshooting

IssueCauseSolution
"Cannot find module"Missing externalAdd to external array
No type definitionsesbuild doesn't generateUse tsc --emitDeclarationOnly
Large bundleNot externalizing depsMark peer deps as external
Wrong module formatIncorrect format settingSet format: 'esm' or 'cjs'
Slow builds (unexpected)Not using esbuild efficientlyCheck for plugins causing slowdown
CSS not bundledNo CSS loaderesbuild bundles CSS by default, check import

Performance

# Benchmark (10K modules)
# esbuild: ~0.3s
# Rollup:  ~10s
# Webpack: ~30s

Checklist

  • Target browsers/node configured
  • External packages for libraries
  • Minify + sourcemap for production
  • Metafile for bundle analysis
  • tsc to generate.d.ts

Further Reading

For advanced configurations: mcp__documentation__fetch_docs - Technology: esbuild - esbuild Docs

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.3%
按下载量换算72

Claude

29.14%
按下载量换算58

Cursor

18.51%
按下载量换算37

Gemini CLI

8.81%
按下载量换算17

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills