vite-bundle-explorer 0.1.1 → 0.2.1
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 +16 -21
- package/dist/assets/index-B1JN1Had.js +63 -0
- package/dist/assets/index-CgYcK0gG.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +9 -3
- package/plugin/stats-plugin.js +39 -8
- package/dist/assets/index-BajBbEJD.css +0 -1
- package/dist/assets/index-CBo5B8y_.js +0 -63
package/README.md
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
# vite-bundle-explorer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Bundle analyzer and visualizer tool for vite.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Current features:
|
|
6
|
+
- Chunk size treemap
|
|
7
|
+
- Module import graph
|
|
8
|
+
- Build stats report
|
|
9
|
+
- Detect duplicated dependencies
|
|
7
10
|
|
|
8
|
-
|
|
11
|
+

|
|
9
12
|
|
|
10
13
|
## How it works
|
|
11
14
|
|
|
12
|
-
`vite-bundle-explorer`
|
|
15
|
+
`vite-bundle-explorer` consists of two main parts:
|
|
13
16
|
|
|
14
|
-
- Vite Plugin: Gathers detailed build statistics
|
|
15
|
-
- CLI Utility: Serves a
|
|
17
|
+
- Vite Plugin: Gathers detailed build statistics in JSON format
|
|
18
|
+
- CLI Utility: Serves a web interface for visualizing the data.
|
|
16
19
|
|
|
17
20
|
## Usage
|
|
18
21
|
|
|
19
|
-
Install the package as a development dependency
|
|
22
|
+
Install the package as a development dependency
|
|
20
23
|
|
|
21
24
|
```shell
|
|
22
25
|
npm install -D vite-bundle-explorer
|
|
26
|
+
# yarn add -D vite-bundle-explorer
|
|
27
|
+
# pnpm add -D vite-bundle-explorer
|
|
23
28
|
```
|
|
24
29
|
|
|
25
30
|
Next, add the `statsPlugin` to your vite config. This plugin will generate a `stats.json` file in your output directory
|
|
26
|
-
|
|
31
|
+
on successful build, containing all bundle stats.
|
|
27
32
|
|
|
28
33
|
```javascript
|
|
29
34
|
import { defineConfig } from 'vite';
|
|
30
|
-
import { statsPlugin } from 'vite-bundle-
|
|
35
|
+
import { statsPlugin } from 'vite-bundle-explorer/plugin';
|
|
31
36
|
|
|
32
37
|
export default defineConfig({
|
|
33
38
|
plugins: [
|
|
@@ -40,15 +45,5 @@ export default defineConfig({
|
|
|
40
45
|
Once your build is complete and `stats.json` is generated, you can launch the web interface using the CLI utility:
|
|
41
46
|
|
|
42
47
|
```shell
|
|
43
|
-
npx vite-bundle-
|
|
48
|
+
npx vite-bundle-explorer ./dist/stats.json
|
|
44
49
|
```
|
|
45
|
-
|
|
46
|
-
This command will open a local server in your browser, providing a comprehensive visualization of your bundle.
|
|
47
|
-
|
|
48
|
-
## Frequently Asked Questions
|
|
49
|
-
|
|
50
|
-
### Q: Why do bundle and module sizes appear larger than their actual production values?
|
|
51
|
-
|
|
52
|
-
A: The module sizes reported by the plugin represent their state _before_ minification and gzip compression.
|
|
53
|
-
|
|
54
|
-
---
|