esbuild-analyzer
v0.2.0
Published
A visualizer esbuild analyzer
Downloads
3,946
Maintainers
Readme
esbuild-analyzer
A visualizer esbuild analyzer
Examples
- https://shuoshubao.github.io/esbuild-analyzer
- https://shuoshubao.github.io/esbuild-analyzer/demo1
Install
npm i -D esbuild-analyzer
Usage
api
.build
const esbuild = require('esbuild')
const AnalyzerPlugin = require('esbuild-analyzer')
esbuild.build({
entryPoints: ['lib/index.js'],
outdir: 'dist',
bundle: true,
metafile: true,
plugins: [AnalyzerPlugin()]
})
.buildSync
const { writeFileSync } = require('fs')
const esbuild = require('esbuild')
const { getEsbuildAnalyzerHtml } = require('esbuild-analyzer')
const result = esbuild.buildSync({
entryPoints: ['lib/index.js'],
outdir: 'dist',
bundle: true,
metafile: true
})
const html = getEsbuildAnalyzerHtml(result.metafile)
writeFileSync('EsbuildAnalyzer.html', html)
cli
# https://esbuild.github.io/api/#metafile
esbuild lib/index.js --outdir=dist --bundle --metafile=meta.json
npx esbuild-analyzer
# Custom parameters
npx esbuild-analyzer --metafile=meta.json --outfile=EsbuildAnalyzer.html