@posthog/webpack-plugin 1.2.4 → 1.2.6
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 +86 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @posthog/webpack-plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Webpack plugin for uploading source maps to PostHog for error tracking.
|
|
4
|
+
|
|
5
|
+
[SEE FULL DOCS](https://posthog.com/docs/error-tracking/upload-source-maps/webpack)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @posthog/webpack-plugin --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Add the plugin to your webpack configuration:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { PosthogWebpackPlugin } from '@posthog/webpack-plugin'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
// ... your webpack config
|
|
22
|
+
plugins: [
|
|
23
|
+
new PosthogWebpackPlugin({
|
|
24
|
+
personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,
|
|
25
|
+
envId: process.env.POSTHOG_PROJECT_ID,
|
|
26
|
+
sourcemaps: {
|
|
27
|
+
enabled: true,
|
|
28
|
+
project: 'my-app',
|
|
29
|
+
version: '1.0.0',
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Configuration Options
|
|
37
|
+
|
|
38
|
+
| Option | Type | Required | Default | Description |
|
|
39
|
+
| ------------------------------ | ---------------------------------------------------- | -------- | -------------------------- | ------------------------------------------- |
|
|
40
|
+
| `personalApiKey` | `string` | Yes | - | Your PostHog personal API key |
|
|
41
|
+
| `envId` | `string` | Yes | - | Your PostHog project/environment ID |
|
|
42
|
+
| `host` | `string` | No | `https://us.i.posthog.com` | PostHog instance host |
|
|
43
|
+
| `logLevel` | `'debug' \| 'info' \| 'warn' \| 'error' \| 'silent'` | No | `'info'` | Logging verbosity |
|
|
44
|
+
| `cliBinaryPath` | `string` | No | Auto-detected | Path to the PostHog CLI binary |
|
|
45
|
+
| `sourcemaps.enabled` | `boolean` | No | `true` in production | Enable source map processing |
|
|
46
|
+
| `sourcemaps.project` | `string` | No | - | Project name for source map grouping |
|
|
47
|
+
| `sourcemaps.version` | `string` | No | - | Version identifier for the release |
|
|
48
|
+
| `sourcemaps.deleteAfterUpload` | `boolean` | No | `true` | Delete source maps after upload |
|
|
49
|
+
| `sourcemaps.batchSize` | `number` | No | - | Number of source maps to upload in parallel |
|
|
50
|
+
|
|
51
|
+
### Full Example
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import path from 'node:path'
|
|
55
|
+
import webpack from 'webpack'
|
|
56
|
+
import { PosthogWebpackPlugin } from '@posthog/webpack-plugin'
|
|
57
|
+
import packageJson from './package.json'
|
|
58
|
+
|
|
59
|
+
const config: webpack.Configuration = {
|
|
60
|
+
mode: 'production',
|
|
61
|
+
entry: './src/index.ts',
|
|
62
|
+
output: {
|
|
63
|
+
filename: 'bundle.js',
|
|
64
|
+
path: path.resolve(__dirname, 'dist'),
|
|
65
|
+
},
|
|
66
|
+
plugins: [
|
|
67
|
+
new PosthogWebpackPlugin({
|
|
68
|
+
personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,
|
|
69
|
+
envId: process.env.POSTHOG_PROJECT_ID,
|
|
70
|
+
host: process.env.POSTHOG_API_HOST,
|
|
71
|
+
logLevel: 'error',
|
|
72
|
+
sourcemaps: {
|
|
73
|
+
enabled: true,
|
|
74
|
+
project: packageJson.name,
|
|
75
|
+
version: packageJson.version,
|
|
76
|
+
deleteAfterUpload: true,
|
|
77
|
+
},
|
|
78
|
+
}),
|
|
79
|
+
],
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export default config
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Questions?
|
|
86
|
+
|
|
87
|
+
### [Check out our community page.](https://posthog.com/docs/error-tracking/upload-source-maps/webpack)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/webpack-plugin",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Webpack plugin for Posthog 🦔",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@posthog/cli": "~0.5.20",
|
|
20
|
-
"@posthog/core": "1.
|
|
20
|
+
"@posthog/core": "1.10.0"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|