packlyze 1.0.4 → 1.0.5
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 +41 -46
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,69 +18,64 @@ Advanced bundle analyzer with insights, recommendations, and historical tracking
|
|
|
18
18
|
- **CLI Tool**: Easy-to-use command-line interface
|
|
19
19
|
- **TypeScript Ready**: Full TypeScript support with type definitions
|
|
20
20
|
|
|
21
|
-
## 🚀
|
|
21
|
+
## 🚀 Quick Start
|
|
22
|
+
|
|
23
|
+
Packlyze can be used in two main ways: as a CLI tool and as a Node.js/TypeScript library.
|
|
24
|
+
|
|
25
|
+
**1. Install Packlyze (globally or with npx):**
|
|
22
26
|
|
|
23
27
|
You can install Packlyze globally or use it via npx:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
npm install -g packlyze
|
|
30
|
+
npm install -g packlyze
|
|
27
31
|
# or
|
|
28
|
-
npx packlyze
|
|
32
|
+
npx packlyze --help
|
|
29
33
|
```
|
|
30
34
|
|
|
35
|
+
**2. Generate a stats file from your bundler (e.g., webpack):**
|
|
31
36
|
|
|
37
|
+
> ⚠️ **Important:**
|
|
38
|
+
> You must generate a valid JSON stats file before running Packlyze.
|
|
39
|
+
> For webpack, use the following command in your project folder:
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
```bash
|
|
42
|
+
npx webpack --profile --json stats.json
|
|
43
|
+
```
|
|
44
|
+
- This will create a readable `stats.json` file in your project directory.
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
**3. Run Packlyze analysis:**
|
|
47
|
+
```bash
|
|
48
|
+
packlyze analyze stats.json
|
|
49
|
+
# or (if using npx)
|
|
50
|
+
npx packlyze analyze stats.json
|
|
51
|
+
```
|
|
36
52
|
|
|
37
|
-
|
|
53
|
+
**4. (Optional) Output an HTML report:**
|
|
54
|
+
```bash
|
|
55
|
+
packlyze analyze stats.json -o ./reports/bundle-report.html
|
|
56
|
+
```
|
|
38
57
|
|
|
39
|
-
|
|
40
|
-
1. **Install Packlyze** (globally or use npx):
|
|
41
|
-
```bash
|
|
42
|
-
npm install -g packlyze
|
|
43
|
-
# or
|
|
44
|
-
npx packlyze --help
|
|
45
|
-
```
|
|
46
|
-
2. **Generate a stats file** from your bundler (e.g., webpack, rollup, esbuild):
|
|
47
|
-
```bash
|
|
48
|
-
# For webpack:
|
|
49
|
-
webpack --profile --json > stats.json
|
|
50
|
-
```
|
|
51
|
-
3. **Run Packlyze analysis**:
|
|
52
|
-
```bash
|
|
53
|
-
packlyze analyze stats.json
|
|
54
|
-
# or (if using npx)
|
|
55
|
-
npx packlyze analyze stats.json
|
|
56
|
-
```
|
|
57
|
-
4. **Output an HTML report to a custom location**:
|
|
58
|
-
```bash
|
|
59
|
-
packlyze analyze stats.json -o ./reports/bundle-report.html
|
|
60
|
-
```
|
|
61
|
-
5. **Get results in JSON format (for CI/CD or automation):**
|
|
62
|
-
```bash
|
|
63
|
-
packlyze analyze stats.json --json
|
|
64
|
-
```
|
|
58
|
+
---
|
|
65
59
|
|
|
66
|
-
|
|
60
|
+
## 🐛 Common Issues & Solutions
|
|
67
61
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
npm install packlyze
|
|
72
|
-
```
|
|
73
|
-
2. **Import and use in your code:**
|
|
74
|
-
```typescript
|
|
75
|
-
import { Packlyze } from 'packlyze';
|
|
62
|
+
- **"Stats file not found":**
|
|
63
|
+
Make sure `stats.json` exists in your folder.
|
|
64
|
+
Generate it using your bundler (see above).
|
|
76
65
|
|
|
77
|
-
|
|
78
|
-
|
|
66
|
+
- **"Invalid JSON in stats file":**
|
|
67
|
+
Your stats file may be corrupted or not plain JSON.
|
|
68
|
+
- Delete the file and re-run the correct webpack command.
|
|
69
|
+
- Open `stats.json` in a text editor; it should start with `{` and be readable.
|
|
79
70
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
- **"webpack not recognized":**
|
|
72
|
+
Install webpack locally in your project:
|
|
73
|
+
```bash
|
|
74
|
+
npm install --save-dev webpack webpack-cli
|
|
83
75
|
```
|
|
76
|
+
Then use `npx webpack ...` to generate stats.
|
|
77
|
+
|
|
78
|
+
---
|
|
84
79
|
|
|
85
80
|
## 📁 File Structure
|
|
86
81
|
|