esbuild-plugin-assets-manifest
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

esbuild-plugin-assets-manifest

npm version test

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"
  }
}

Package Sidebar

Install

npm i esbuild-plugin-assets-manifest

Weekly Downloads

1,031

Version

1.0.8

License

MIT

Unpacked Size

9.48 kB

Total Files

6

Last publish

Collaborators

  • indooorsman