mirror of
https://github.com/hanzoai/insights-js.git
synced 2026-10-30 18:34:19 +00:00
A version written into a manifest is written into every manifest that wants it, which is how eslint came to exist in a hundred and four forms across this estate and how a package came to resolve twice at run time. The catalog moves the number out of the manifest: a manifest names the package, the workspace names the version. Four are held below their latest because the newer release cannot be used, and the reason is recorded rather than the version alone: @noble/hashes 2 renamed every subpath the web3 stack imports, @splinetool/runtime 2 depends on a package that was never published, @dynamic-labs 5.4.1 the same, and react-resizable-panels 3 points its types condition at the bundle.
@hanzo/webpack-plugin
Webpack plugin for uploading source maps to Insights for error tracking.
Installation
npm install @hanzo/webpack-plugin --save-dev
Usage
Add the plugin to your webpack configuration:
import { InsightsWebpackPlugin } from '@hanzo/webpack-plugin'
export default {
// ... your webpack config
plugins: [
new InsightsWebpackPlugin({
personalApiKey: process.env.INSIGHTS_PERSONAL_API_KEY,
projectId: process.env.INSIGHTS_PROJECT_ID,
sourcemaps: {
enabled: true,
releaseName: 'my-app',
releaseVersion: '1.0.0',
},
}),
],
}
Configuration Options
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
personalApiKey |
string |
Yes | - | Your Insights personal API key |
projectId |
string |
Yes | - | Your Insights project/environment ID |
envId |
string |
No | - | Deprecated alias for projectId |
host |
string |
No | https://us.i.insights.hanzo.ai |
Insights instance host |
logLevel |
'debug' | 'info' | 'warn' | 'error' | 'silent' |
No | 'info' |
Logging verbosity |
cliBinaryPath |
string |
No | Auto-detected | Path to the Insights CLI binary |
sourcemaps.enabled |
boolean |
No | true in production |
Enable source map processing |
sourcemaps.releaseName |
string |
No | - | Release name for source map grouping |
sourcemaps.releaseVersion |
string |
No | - | Version identifier for the release |
sourcemaps.deleteAfterUpload |
boolean |
No | true |
Delete source maps after upload |
sourcemaps.batchSize |
number |
No | - | Number of source maps to upload in parallel |
Full Example
import path from 'node:path'
import webpack from 'webpack'
import { InsightsWebpackPlugin } from '@hanzo/webpack-plugin'
import packageJson from './package.json'
const config: webpack.Configuration = {
mode: 'production',
entry: './src/index.ts',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new InsightsWebpackPlugin({
personalApiKey: process.env.INSIGHTS_PERSONAL_API_KEY,
projectId: process.env.INSIGHTS_PROJECT_ID,
host: process.env.INSIGHTS_API_HOST,
logLevel: 'error',
sourcemaps: {
enabled: true,
releaseName: packageJson.name,
releaseVersion: packageJson.version,
deleteAfterUpload: true,
},
}),
],
}
export default config