Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shuoshubao/esbuild-analyzer
https://github.com/shuoshubao/esbuild-analyzer
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/shuoshubao/esbuild-analyzer
- Owner: shuoshubao
- License: mit
- Created: 2022-12-29T06:00:51.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-17T08:59:27.000Z (almost 2 years ago)
- Last Synced: 2024-10-31T03:22:08.439Z (3 months ago)
- Language: HTML
- Size: 1.38 MB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-esbuild - esbuild-analyzer
README
# esbuild-analyzer
A visualizer esbuild analyzer
# Examples
- https://shuoshubao.github.io/esbuild-analyzer
- https://shuoshubao.github.io/esbuild-analyzer/demo1# Install
```sh
npm i -D esbuild-analyzer
```# Usage
## api
### .build
```js
const esbuild = require('esbuild')
const AnalyzerPlugin = require('esbuild-analyzer')esbuild.build({
entryPoints: ['lib/index.js'],
outdir: 'dist',
bundle: true,
metafile: true,
plugins: [AnalyzerPlugin()]
})
```### .buildSync
```js
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
```sh
# https://esbuild.github.io/api/#metafile
esbuild lib/index.js --outdir=dist --bundle --metafile=meta.json
``````sh
npx esbuild-analyzer# Custom parameters
npx esbuild-analyzer --metafile=meta.json --outfile=EsbuildAnalyzer.html
```