Upload source maps for Webpack
- 1
Install the PostHog Webpack plugin
RequiredTerminal - 2
Add PostHog plugin to your Webpack config
RequiredAdd the following to your
webpack.config.jsfile:webpack.config.jsWhere you should set the following environment variables:
Environment Variable Description POSTHOG_API_KEYPersonal API key with at least writeaccess onerror trackingPOSTHOG_ENV_IDProject ID you can find in your project settings POSTHOG_HOST(optional) Your PostHog instance URL. Defaults to https://us.i.posthog.comIf you are using a CI/CD service, make sure these environment variables are added to your project settings, not just your local setup. This enables source maps to be automatically uploaded on your production build.