@bundle-lens/webpack-plugin
v1.0.1
Published
BundleLens webpack 5 plugin: writes a per-build SQLite database of chunk data (size, source modules, emitted files + contentHash) during processAssets. Re-exports the @bundle-lens/core query/store surface.
Maintainers
Readme
@bundle-lens/webpack-plugin
Webpack 5 plugin for BundleLens. During processAssets it writes a per-build SQLite
database of chunk data — size, the source modules each chunk comprises (identifier + size),
and the emitted output files plus a contentHash — to
.bundle-lens/<buildId>/<variant>.sqlite. There is no intermediate manifest file; the database is
the single source of truth that the host pipeline later merges into the per-app store.blz.
It re-exports the full @bundle-lens/core store/codec/query surface, so a consumer
that only depends on the plugin (e.g. an upload stage) can open, merge, and query the store
without a separate @bundle-lens/core dependency.
Install
yarn add -D @bundle-lens/webpack-plugin # webpack 5 is a peer dependencyUsage
// webpack.config.js
const { BundleLensPlugin } = require('@bundle-lens/webpack-plugin');
module.exports = {
plugins: [
new BundleLensPlugin({
buildId: `${process.env.VERSION}-${process.env.GIT_SHA}`, // the "release"
variant: 'client', // stable db name (client / server)
outputDir: '.bundle-lens', // defaults to `.bundle-lens`
}),
],
};Options
| Option | Type | Default | Description |
| --- | --- | --- | --- |
| buildId | string | — (required) | Release id recorded on every chunk (e.g. 1.2.3-abc1234). |
| variant | string | client | Compilation name; keeps the local db path stable per compilation. |
| outputDir | string | .bundle-lens | Root directory for the per-build SQLite database. |
See the repository README for the store model and query tooling.
