vite-bundle-explorer 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,12 +2,11 @@
2
2
 
3
3
  Bundle analyzer and visualizer tool for vite.
4
4
 
5
- Current features:
6
-
7
- - Chunk size treemap
8
- - Module import graph
9
- - Build stats report
10
- - Detect duplicated dependencies
5
+ - ✅ Supports both applications and libraries
6
+ - ✅ Supports `vite`, `rollup`, `rolldown` and `tsdown`
7
+ - ✅ Chunk treemap
8
+ - ✅ Module import graph
9
+ - ✅ Detect duplicated dependencies
11
10
 
12
11
  ![preview](https://raw.githubusercontent.com/Solant/vite-bundle-explorer/refs/heads/main/preview.gif)
13
12
 
@@ -63,9 +62,10 @@ export default defineConfig({
63
62
  });
64
63
  ```
65
64
 
66
- | Parameter | Type | Default | Description |
67
- |------------------------|-----------|--------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------|
68
- | `reportCompressedSize` | `boolean` | Same as Vite's [build.reportCompressedSize](https://vite.dev/config/build-options.html#build-reportcompressedsize) | Calculate compressed size of chunks. Might affect performance. |
69
- | `reportDirectoryName` | `string` | `"bundle-report"` | Name of the output directory |
70
- | `emitHtml` | `boolean` | `true` | Generate interactive HTML report |
71
- | `emitJson` | `boolean` | `false` | Generate `stats.json` file |
65
+ | Parameter | Type | Default | Description |
66
+ |------------------------|-----------|-------------------|------------------------------------------------------------------------------------------------------------|
67
+ | `enabled` | `boolean` | `true` | Disables stats collection and report generation. This option is disabled automatically for `vite dev` mode |
68
+ | `reportCompressedSize` | `boolean` | `true` | Calculate compressed size of chunks. Might affect performance. |
69
+ | `reportDirectoryName` | `string` | `"bundle-report"` | Name of the output directory |
70
+ | `emitHtml` | `boolean` | `true` | Generate interactive HTML report |
71
+ | `emitJson` | `boolean` | `false` | Generate `stats.json` file |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-bundle-explorer",
3
3
  "description": "Bundle analyzer and visualizer tool for Vite",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/Solant/vite-bundle-explorer#readme",
7
7
  "repository": {
@@ -1,6 +1,7 @@
1
1
  import { type Plugin } from 'vite';
2
2
 
3
3
  interface StatsPluginOptions {
4
+ enabled?: boolean;
4
5
  reportDirectoryName?: string;
5
6
  reportCompressedSize?: boolean;
6
7
  emitHtml?: boolean;
@@ -33,11 +33,7 @@ export function statsPlugin(options) {
33
33
  // vite specific hook
34
34
  configResolved(config) {
35
35
  // disable during dev mode
36
- enabled = config.env.PROD;
37
- },
38
- outputOptions(opts) {
39
- // workaround for libraries with multiple output formats
40
- enabled = opts.format === 'es';
36
+ enabled = enabled && config.env.PROD;
41
37
  },
42
38
  resolveId: {
43
39
  order: 'pre',
@@ -108,6 +104,8 @@ export function statsPlugin(options) {
108
104
  if (!enabled || error) {
109
105
  return;
110
106
  }
107
+ // prevent this hook from being called again for a different format
108
+ enabled = false;
111
109
  // create a target directory
112
110
  const target = join(root, options?.reportDirectoryName ?? REPORT_DIR_NAME);
113
111
  try {