https://github.com/indooorsman/esbuild-plugin-assets-manifest
Generate manifest file like assets-webpack-plugin
https://github.com/indooorsman/esbuild-plugin-assets-manifest
assets esbuild-plugin manifest
Last synced: about 1 year ago
JSON representation
Generate manifest file like assets-webpack-plugin
- Host: GitHub
- URL: https://github.com/indooorsman/esbuild-plugin-assets-manifest
- Owner: indooorsman
- License: mit
- Created: 2021-08-18T01:32:55.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-09-09T09:08:09.000Z (almost 3 years ago)
- Last Synced: 2025-02-23T17:37:17.606Z (over 1 year ago)
- Topics: assets, esbuild-plugin, manifest
- Language: JavaScript
- Homepage:
- Size: 31.3 KB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-assets-manifest
[](https://www.npmjs.com/package/esbuild-plugin-assets-manifest)
[](https://github.com/indooorsman/esbuild-plugin-assets-manifest/actions/workflows/test.yml)
Generate manifest file like [assets-webpack-plugin](https://github.com/ztoben/assets-webpack-plugin)
## Usage
See [./test](https://github.com/indooorsman/esbuild-plugin-assets-manifest/tree/main/test) for example.
```bash
npm install -D esbuild-plugin-assets-manifest
```
```js
const assetsManifest = require('esbuild-plugin-assets-manifest');
esbuild.build({
// entryPoints must be object to generate expected manifest file
entryPoints: {
app: './index.js'
},
outdir: './dist',
target: 'esnext',
entryNames: '[name]-[hash]',
publicPath: '/static',
bundle: true,
metafile: true,
plugins: [
assetsManifest({
filename: 'myapp-manifest.json',
path: './dist',
metadata: { timestamp: new Date(), module: 'myapp', type: 'esm' },
processOutput(assets) {
const orderAssets = {
app: assets['app'],
...assets
};
return JSON.stringify(orderAssets, null, ' ');
}
})
]
});
```
### Configuration
See [index.d.ts](https://github.com/indooorsman/esbuild-plugin-assets-manifest/tree/main/index.d.ts)
### Output
```js
// myapp-manifest.json
{
"app": {
"js": "/static/app-VYODTBBJ.js",
"css": "/static/app-GXI4CST6.css"
},
"": {
"jpg": [
"/static/world-7U6P4ADE.jpg"
]
},
"metadata": {
"timestamp": "2022-01-30T03:45:07.655Z",
"module": "myapp",
"type": "esm"
}
}
```