esbuild-plugin-assets-manifest
v1.0.8
Published
Generate manifest file like assets-webpack-plugin
Downloads
5,178
Maintainers
Readme
esbuild-plugin-assets-manifest
Generate manifest file like assets-webpack-plugin
Usage
See ./test for example.
npm install -D esbuild-plugin-assets-manifest
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
Output
// 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"
}
}