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 +12 -12
- package/package.json +1 -1
- package/plugin/stats-plugin.d.ts +1 -0
- package/plugin/stats-plugin.js +3 -5
package/README.md
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Bundle analyzer and visualizer tool for vite.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- Chunk
|
|
8
|
-
- Module import graph
|
|
9
|
-
-
|
|
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
|

|
|
13
12
|
|
|
@@ -63,9 +62,10 @@ export default defineConfig({
|
|
|
63
62
|
});
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
| Parameter | Type | Default
|
|
67
|
-
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
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
package/plugin/stats-plugin.d.ts
CHANGED
package/plugin/stats-plugin.js
CHANGED
|
@@ -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 {
|