Showing preview only (224K chars total). Download the full file or copy to clipboard to get everything.
Repository: nuxt-community/sentry-module
Branch: main
Commit: e64d22ed6f7a
Files: 96
Total size: 201.2 KB
Directory structure:
gitextract_f2taf_wd/
├── .editorconfig
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ ├── feature_request.md
│ │ └── question.md
│ └── workflows/
│ ├── ci.yml
│ └── size-limit.yml
├── .gitignore
├── .npmrc
├── .nvmrc
├── .release-it.cjs
├── .size-limit.cjs
├── CHANGELOG.md
├── LICENSE
├── README.md
├── build.config.ts
├── docs/
│ ├── .gitignore
│ ├── .nvmrc
│ ├── README.md
│ ├── content/
│ │ ├── en/
│ │ │ ├── configuration/
│ │ │ │ ├── options.md
│ │ │ │ └── runtime-config.md
│ │ │ ├── getting-started/
│ │ │ │ └── setup.md
│ │ │ ├── guide/
│ │ │ │ ├── enrich-events.md
│ │ │ │ ├── lazy-loading.md
│ │ │ │ ├── migration.md
│ │ │ │ ├── performance.md
│ │ │ │ ├── profiling.md
│ │ │ │ ├── releases.md
│ │ │ │ ├── session-replay.md
│ │ │ │ ├── usage.md
│ │ │ │ └── user-feedback.md
│ │ │ └── index.md
│ │ └── settings.json
│ ├── nuxt.config.js
│ ├── package.json
│ └── patches/
│ └── @nuxtjs+tailwindcss+3.4.3.patch
├── eslint.config.mjs
├── netlify.toml
├── package.json
├── renovate.json
├── size-check/
│ ├── base/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ └── index.vue
│ ├── lazy/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ └── index.vue
│ ├── lazy+tracing/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ └── index.vue
│ ├── package.json
│ ├── replay/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ └── index.vue
│ ├── tracing/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ └── index.vue
│ └── typescript/
│ ├── config/
│ │ └── server.config.ts
│ ├── nuxt.config.ts
│ ├── pages/
│ │ └── index.vue
│ └── tsconfig.json
├── src/
│ ├── hooks.ts
│ ├── kit-shim.ts
│ ├── module.ts
│ ├── options.ts
│ ├── templates/
│ │ ├── client.shared.js
│ │ ├── options.ejs
│ │ ├── plugin.client.js
│ │ ├── plugin.lazy.js
│ │ ├── plugin.mocked.js
│ │ └── plugin.server.js
│ ├── types/
│ │ ├── configuration.d.ts
│ │ ├── extend.d.ts
│ │ ├── index.d.ts
│ │ └── sentry.d.ts
│ └── utils.ts
├── test/
│ ├── default.test.ts
│ ├── fixture/
│ │ ├── default/
│ │ │ ├── config/
│ │ │ │ └── custom-client-integrations.js
│ │ │ ├── nuxt.config.cjs
│ │ │ └── pages/
│ │ │ └── index.vue
│ │ ├── lazy/
│ │ │ ├── config/
│ │ │ │ └── custom-client-integrations.js
│ │ │ ├── nuxt.config.cjs
│ │ │ └── pages/
│ │ │ └── index.vue
│ │ ├── typescript/
│ │ │ ├── api/
│ │ │ │ └── index.ts
│ │ │ ├── config/
│ │ │ │ ├── custom-client-integrations.ts
│ │ │ │ └── server.config.ts
│ │ │ ├── nuxt.config.ts
│ │ │ ├── pages/
│ │ │ │ ├── disabled-integrations.vue
│ │ │ │ └── index.vue
│ │ │ └── tsconfig.json
│ │ └── with-lazy-config/
│ │ ├── nuxt.config.cjs
│ │ └── pages/
│ │ ├── index.vue
│ │ └── mounted.vue
│ ├── lazy.test.ts
│ ├── options.test.ts
│ ├── tsconfig.json
│ ├── typescript.test.ts
│ ├── utils.ts
│ └── with-lazy-config.test.ts
├── tsconfig.json
├── types/
│ └── vuex.d.ts
└── vitest.config.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
# editorconfig.org
root = true
[*]
indent_size = 2
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Report a bug report to help us improve the module.
title: ''
labels: bug
assignees: ''
---
### Version
@nuxtjs/sentry: <!-- ex: 5.9.0 -->
nuxt: <!-- ex: 2.0.0 -->
### Sentry configuration
<!--
If relevant, please include the configuration you are using for this module.
```
-->
### Reproduction Link
<!--
A minimal test case on codesandbox or in a repository that can be used to reproduce the bug.
-->
### Steps to reproduce
### What is Expected?
### What is actually happening?
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
- name: Nuxt Community Discord
url: https://discord.nuxtjs.org/
about: Consider asking questions about the module here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea or enhancement for this project.
title: ''
labels: feature-request
assignees: ''
---
### Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
### Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
### Additional context
<!-- Add any other context or screenshots about the feature request here. -->
================================================
FILE: .github/ISSUE_TEMPLATE/question.md
================================================
---
name: Question
about: Ask a question about the module.
title: ''
labels: question
assignees: ''
---
<!--
**IMPORTANT!**
Please make sure to look for an answer to your question in our documentation before asking a question here.
If relevant to your question, provide module configuration.
If you have a general question regarding the module use Discord `modules` channel. Thanks!
Nuxt Discord: https://discord.nuxtjs.org/
-->
================================================
FILE: .github/workflows/ci.yml
================================================
---
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Lint and test
runs-on: ubuntu-latest
env:
CI: true
strategy:
fail-fast: false
matrix:
node-version: [18, 20]
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: yarn install
run: yarn
- name: Unittesting
run: yarn test
- name: Linting
if: ${{ matrix.node-version == '18' }}
run: yarn lint
================================================
FILE: .github/workflows/size-limit.yml
================================================
---
name: size
on:
pull_request:
branches:
- main
jobs:
size:
name: Size Check
runs-on: ubuntu-latest
env:
CI: true
CI_JOB_NUMBER: 1
strategy:
fail-fast: false
matrix:
node-version: [20]
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
- name: Check bundle sizes
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
build_script: size
================================================
FILE: .gitignore
================================================
# Dependencies
node_modules
# Logs
*.log*
# Temp directories
.temp
.tmp
.cache
# Yarn
**/.yarn/cache
**/.yarn/*state*
# Generated dirs
dist
# Nuxt
.nuxt
.output
.vercel_build_output
.build-*
.env
.netlify
# Env
.env
# Testing
reports
*.lcov
.nyc_output
# VSCode
.vscode
# Intellij idea
*.iml
.idea
# OSX
.DS_Store
.AppleDouble
.LSOverride
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
================================================
FILE: .npmrc
================================================
registry=https://registry.npmjs.org/
================================================
FILE: .nvmrc
================================================
20
================================================
FILE: .release-it.cjs
================================================
/* eslint-disable no-template-curly-in-string */
module.exports = {
git: {
commitMessage: 'chore: release ${version}',
tagName: 'v${version}',
},
npm: {
publish: true,
},
github: {
release: true,
releaseName: '${version}',
releaseNotes (ctx) {
// Remove first, redundant line with the version and the date.
return ctx.changelog.split('\n').slice(1).join('\n')
},
},
plugins: {
'@release-it/conventional-changelog': {
preset: 'conventionalcommits',
infile: 'CHANGELOG.md',
},
},
}
================================================
FILE: .size-limit.cjs
================================================
module.exports = [
{
name: 'fixture: base',
path: 'size-check/base/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
{
name: 'fixture: replay',
path: 'size-check/replay/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
{
name: 'fixture: lazy',
path: 'size-check/lazy/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
{
name: 'fixture: tracing',
path: 'size-check/tracing/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
{
name: 'fixture: lazy+tracing',
path: 'size-check/lazy+tracing/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
{
name: 'fixture: typescript',
path: 'size-check/typescript/.nuxt/dist/client/',
gzip: false,
brotli: false,
},
]
================================================
FILE: CHANGELOG.md
================================================
## [8.0.8](https://github.com/nuxt-community/sentry-module/compare/v8.0.7...v8.0.8) (2024-09-13)
### Bug Fixes
* **deps:** update devdependency @sentry/webpack-plugin to v2.22.3 ([#688](https://github.com/nuxt-community/sentry-module/issues/688)) ([e84d715](https://github.com/nuxt-community/sentry-module/commit/e84d71511d899398f186990ce68f41d9469774f6))
* **deps:** update sentry sdk ([#666](https://github.com/nuxt-community/sentry-module/issues/666)) ([9d5dd24](https://github.com/nuxt-community/sentry-module/commit/9d5dd24d43ef962db5ea2043c359088af283e68b))
* type declarations don't work with "moduleResolution: node16" ([8fe70f0](https://github.com/nuxt-community/sentry-module/commit/8fe70f09ebf708a0ac40c17d4863c7d2aecc0b9b))
## [8.0.7](https://github.com/nuxt-community/sentry-module/compare/v8.0.6...v8.0.7) (2024-02-07)
### Bug Fixes
* **deps:** update devdependency @sentry/profiling-node to v7 ([#665](https://github.com/nuxt-community/sentry-module/issues/665)) ([df52090](https://github.com/nuxt-community/sentry-module/commit/df5209004dbb9a5016fca32204df7cfdf00af0eb))
* **deps:** update sentry sdk ([#656](https://github.com/nuxt-community/sentry-module/issues/656)) ([89c6576](https://github.com/nuxt-community/sentry-module/commit/89c6576b173e138d891926ee677d2468f296d578))
## [8.0.6](https://github.com/nuxt-community/sentry-module/compare/v8.0.4...v8.0.6) (2023-11-27)
### Bug Fixes
* **deps:** update sentry sdk to ^7.81.1 ([#653](https://github.com/nuxt-community/sentry-module/issues/653)) ([2c17b30](https://github.com/nuxt-community/sentry-module/commit/2c17b30f670b608e9064e7b6f576f23b2cfb180a))
* make it possible to disable internal SDK integrations ([#655](https://github.com/nuxt-community/sentry-module/issues/655)) ([fd32a7e](https://github.com/nuxt-community/sentry-module/commit/fd32a7e47e0556013c4f7b7a2998e796e136ca22))
## [8.0.4](https://github.com/nuxt-community/sentry-module/compare/v8.0.3...v8.0.4) (2023-11-20)
### Bug Fixes
* **deps:** update sentry sdk ([#646](https://github.com/nuxt-community/sentry-module/issues/646)) ([630c80b](https://github.com/nuxt-community/sentry-module/commit/630c80b9b70c251f2628157ad6554b7c14070497))
* set `root` for RewriteFrames integration ([#650](https://github.com/nuxt-community/sentry-module/issues/650)) ([d8c4733](https://github.com/nuxt-community/sentry-module/commit/d8c4733788190307d45cab0ba7f7efd13caae071))
## [8.0.3](https://github.com/nuxt-community/sentry-module/compare/v8.0.2...v8.0.3) (2023-11-16)
### Bug Fixes
* crash on handling unhandled exceptions ([#647](https://github.com/nuxt-community/sentry-module/issues/647)) ([007d84d](https://github.com/nuxt-community/sentry-module/commit/007d84d73e4acb9598641076e4712bbd928c66dc))
## [8.0.2](https://github.com/nuxt-community/sentry-module/compare/v8.0.1...v8.0.2) (2023-11-13)
### Bug Fixes
* **deps:** update sentry sdk ([#632](https://github.com/nuxt-community/sentry-module/issues/632)) ([2de0ed1](https://github.com/nuxt-community/sentry-module/commit/2de0ed19b2b67fe53c9403477304e8f15ada8a7c))
* support external configuration in form of *.ts ([#639](https://github.com/nuxt-community/sentry-module/issues/639)) ([e481548](https://github.com/nuxt-community/sentry-module/commit/e48154899a4a5a3a5fb8b67664f3ae394f995056))
## [8.0.1](https://github.com/nuxt-community/sentry-module/compare/v8.0.0...v8.0.1) (2023-10-31)
### Bug Fixes
* **deps:** update sentry sdk to 7.77.0 ([#624](https://github.com/nuxt-community/sentry-module/issues/624)) ([a5073d1](https://github.com/nuxt-community/sentry-module/commit/a5073d10ce96d157e6349029a98ee1c09abd9582))
## [8.0.0](https://github.com/nuxt-community/sentry-module/compare/v7.5.0...v8.0.0) (2023-10-31)
### ⚠ BREAKING CHANGES
* See migration guide at https://sentry.nuxtjs.org/guide/migration
### Features
* upgrade to webpack-plugin v2 for making releases ([#616](https://github.com/nuxt-community/sentry-module/issues/616)) ([b981638](https://github.com/nuxt-community/sentry-module/commit/b981638304bbad33d9896e25dd78cf518a43ae1a))
### Bug Fixes
* **deps:** update devdependency @sentry/webpack-plugin to v2.8.0 ([#621](https://github.com/nuxt-community/sentry-module/issues/621)) ([d981f1f](https://github.com/nuxt-community/sentry-module/commit/d981f1fbaa4b50fe608339c393802871d5f1d751))
* **deps:** update sentry sdk ([#604](https://github.com/nuxt-community/sentry-module/issues/604)) ([3ae9b5b](https://github.com/nuxt-community/sentry-module/commit/3ae9b5b746ec01031bfd001c764fad30f8343180))
## [8.0.0-rc.0](https://github.com/nuxt-community/sentry-module/compare/v7.5.0...v8.0.0-rc.0) (2023-09-19)
### ⚠ BREAKING CHANGES
* **publishRelease:** See migration guide at https://sentry.nuxtjs.org/guide/migration
### Features
* **publishRelease:** upgrade to webpack-plugin v2 ([d3ed0eb](https://github.com/nuxt-community/sentry-module/commit/d3ed0ebbec899d24ce13b963d9132282e5cdc26a))
## [7.5.0](https://github.com/nuxt-community/sentry-module/compare/v7.4.0...v7.5.0) (2023-08-28)
### Features
* **tracing:** allow configuring vueRouterInstrumentation options ([#614](https://github.com/nuxt-community/sentry-module/issues/614)) ([977a74e](https://github.com/nuxt-community/sentry-module/commit/977a74e7b28f360116514258adcf8cbcec2b5be1))
## [7.4.0](https://github.com/nuxt-community/sentry-module/compare/v7.3.1...v7.4.0) (2023-08-11)
### Bug Fixes
* **deps:** update sentry sdk ([#593](https://github.com/nuxt-community/sentry-module/issues/593)) ([35daec5](https://github.com/nuxt-community/sentry-module/commit/35daec5a015bf087893fd13f20d13a415e9a9c3a))
* **deps:** update sentry sdk to ^7.63.0 ([ecdce1f](https://github.com/nuxt-community/sentry-module/commit/ecdce1f6f7488b016f1f8949a9455cf7ebc2d9d9))
* **lazy:** avoid crash on using mocked instance after real one loaded ([#606](https://github.com/nuxt-community/sentry-module/issues/606)) ([e728a34](https://github.com/nuxt-community/sentry-module/commit/e728a349e212cb422a385ee8619cf00353b318fd))
## [7.3.1](https://github.com/nuxt-community/sentry-module/compare/v7.3.0...v7.3.1) (2023-07-04)
### Bug Fixes
* **deps:** update sentry sdk to ^7.57.0 ([663147b](https://github.com/nuxt-community/sentry-module/commit/663147b0ca6a78d01056de44a538965113291ba4))
## [7.3.0](https://github.com/nuxt-community/sentry-module/compare/v7.2.6...v7.3.0) (2023-05-21)
### Features
* **profiling:** add support for enabling Profiling integration ([#577](https://github.com/nuxt-community/sentry-module/issues/577)) ([9a9aa85](https://github.com/nuxt-community/sentry-module/commit/9a9aa859bec6ca9c6032f3dba5d8f06286fea6ff))
### Bug Fixes
* **deps:** update sentry sdk to ^7.52.1 ([#573](https://github.com/nuxt-community/sentry-module/issues/573)) ([a74cf7f](https://github.com/nuxt-community/sentry-module/commit/a74cf7f8ac63ec2db1f447dd458241311ef7e804))
* **tracing:** tracing not enabled on the server ([#575](https://github.com/nuxt-community/sentry-module/issues/575)) ([7839d03](https://github.com/nuxt-community/sentry-module/commit/7839d037beef628c6c2f5b2860e16fcd3e9617f8))
### [7.2.6](https://github.com/nuxt-community/sentry-module/compare/v7.2.5...v7.2.6) (2023-05-10)
### Bug Fixes
* crash happening when `@nuxt/kit` is installed ([#571](https://github.com/nuxt-community/sentry-module/issues/571)) ([10e650a](https://github.com/nuxt-community/sentry-module/commit/10e650a21881877d7ee89253defabaef77a71c9c))
### [7.2.5](https://github.com/nuxt-community/sentry-module/compare/v7.2.4...v7.2.5) (2023-05-10)
### Bug Fixes
* config merging order on the server side ([#568](https://github.com/nuxt-community/sentry-module/issues/568)) ([4fc42dd](https://github.com/nuxt-community/sentry-module/commit/4fc42dd6c3ebc3947ebf84529b3a7d4b0354c812))
### [7.2.4](https://github.com/nuxt-community/sentry-module/compare/v7.2.3...v7.2.4) (2023-05-09)
### Bug Fixes
* **deps:** update sentry sdk ([#563](https://github.com/nuxt-community/sentry-module/issues/563)) ([bcb9500](https://github.com/nuxt-community/sentry-module/commit/bcb95002ceaedffed5056f55241abad59b91879e))
* remove use of unctx to avoid issues with conflicting versions ([#566](https://github.com/nuxt-community/sentry-module/issues/566)) ([d8dc14b](https://github.com/nuxt-community/sentry-module/commit/d8dc14b06f3276fef2d41c80c5608b75d9543ae5))
### [7.2.3](https://github.com/nuxt-community/sentry-module/compare/v7.2.2...v7.2.3) (2023-05-02)
### Bug Fixes
* ensure Sentry re-initializes in Dev after Nuxt config change ([#565](https://github.com/nuxt-community/sentry-module/issues/565)) ([5ee045d](https://github.com/nuxt-community/sentry-module/commit/5ee045d0c7393070e45505ca1c922c0f4ce7168a))
### [7.2.2](https://github.com/nuxt-community/sentry-module/compare/v7.2.1...v7.2.2) (2023-04-20)
### Bug Fixes
* **deps:** add `@sentry/core` explicitly as its used in types ([7124678](https://github.com/nuxt-community/sentry-module/commit/7124678e4d1e8a787594958ced3bbe5e0e23d42b))
### [7.2.1](https://github.com/nuxt-community/sentry-module/compare/v7.2.0...v7.2.1) (2023-04-18)
### Bug Fixes
* only include 'crash' type for `ReportingObserver` integration ([#560](https://github.com/nuxt-community/sentry-module/issues/560)) ([782b9d1](https://github.com/nuxt-community/sentry-module/commit/782b9d186bcc6fc144c229876a8321a48789a3f2))
## [7.2.0](https://github.com/nuxt-community/sentry-module/compare/v7.1.13...v7.2.0) (2023-04-18)
### Features
* extend guides in docs and add simpler way to enable Replay ([#559](https://github.com/nuxt-community/sentry-module/issues/559)) ([fd57b07](https://github.com/nuxt-community/sentry-module/commit/fd57b070832a3fbe2457d681c063cd59fe910745))
### Bug Fixes
* **deps:** update sentry sdk to ^7.48.0 ([#545](https://github.com/nuxt-community/sentry-module/issues/545)) ([30b283a](https://github.com/nuxt-community/sentry-module/commit/30b283a395c43027d5b0b06e2604f988c262003d))
### [7.1.13](https://github.com/nuxt-community/sentry-module/compare/v7.1.12...v7.1.13) (2023-04-11)
### Bug Fixes
* don't shutdown Sentry SDK after build in dev mode ([#555](https://github.com/nuxt-community/sentry-module/issues/555)) ([b4c1312](https://github.com/nuxt-community/sentry-module/commit/b4c13126da05c9d382567077623553bb63f5a164))
### [7.1.12](https://github.com/nuxt-community/sentry-module/compare/v7.1.11...v7.1.12) (2023-04-11)
### Bug Fixes
* **deps:** update sentry sdk to ^7.47.0 ([#552](https://github.com/nuxt-community/sentry-module/issues/552)) ([30c1a97](https://github.com/nuxt-community/sentry-module/commit/30c1a97cf0769fb94591f017914227dc0df8db57))
* shutdown server Sentry SDK when `nuxt build` is done ([#551](https://github.com/nuxt-community/sentry-module/issues/551)) ([f24cfb2](https://github.com/nuxt-community/sentry-module/commit/f24cfb26a132f5214a8a81f5a2158e3f5317f4c2))
### [7.1.11](https://github.com/nuxt-community/sentry-module/compare/v7.1.10...v7.1.11) (2023-04-03)
### Bug Fixes
* resolve aliases relative to module's dir ([#548](https://github.com/nuxt-community/sentry-module/issues/548)) ([94d7c90](https://github.com/nuxt-community/sentry-module/commit/94d7c907d89e977928f9838b3de7c8af016428a4))
* significantly reduce client bundle size ([#547](https://github.com/nuxt-community/sentry-module/issues/547)) ([ad8eefd](https://github.com/nuxt-community/sentry-module/commit/ad8eefd0e4359f23701f3b92ea2d0d398772404d))
### [7.1.10](https://github.com/nuxt-community/sentry-module/compare/v7.1.9...v7.1.10) (2023-03-28)
### Bug Fixes
* **types:** allow "false" in integrations options ([#543](https://github.com/nuxt-community/sentry-module/issues/543)) ([f4ffef2](https://github.com/nuxt-community/sentry-module/commit/f4ffef24f4d9afeb54cee2253a9252e380fa11ca))
### [7.1.9](https://github.com/nuxt-community/sentry-module/compare/v7.1.8...v7.1.9) (2023-03-27)
### Bug Fixes
* **types:** restore original client types which have more methods ([#540](https://github.com/nuxt-community/sentry-module/issues/540)) ([16bc644](https://github.com/nuxt-community/sentry-module/commit/16bc644d5bdfb363c9d5fa2f9fd222feea21b2c4))
### [7.1.8](https://github.com/nuxt-community/sentry-module/compare/v7.1.7...v7.1.8) (2023-03-27)
### Bug Fixes
* **types:** fix "any" type in arguments of config.beforeSend ([#539](https://github.com/nuxt-community/sentry-module/issues/539)) ([b4b5b48](https://github.com/nuxt-community/sentry-module/commit/b4b5b48a35b8e6276758615cafbf9ad7914aeda2))
### [7.1.7](https://github.com/nuxt-community/sentry-module/compare/v7.1.6...v7.1.7) (2023-03-27)
### Bug Fixes
* **types:** restore type for process.sentry and improve $sentry types ([#534](https://github.com/nuxt-community/sentry-module/issues/534)) ([ed6fd1c](https://github.com/nuxt-community/sentry-module/commit/ed6fd1cffde640d779c541b494fa9654997ee534))
### [7.1.6](https://github.com/nuxt-community/sentry-module/compare/v7.1.5...v7.1.6) (2023-03-24)
### Bug Fixes
* significantly reduce client bundle size ([#532](https://github.com/nuxt-community/sentry-module/issues/532)) ([2297dbc](https://github.com/nuxt-community/sentry-module/commit/2297dbc1a0ce37225877924a0307700ff8eb25e1))
### [7.1.5](https://github.com/nuxt-community/sentry-module/compare/v7.1.4...v7.1.5) (2023-03-24)
### Bug Fixes
* **deps:** update sentry sdk to ^7.43.0 ([#522](https://github.com/nuxt-community/sentry-module/issues/522)) ([80de6b9](https://github.com/nuxt-community/sentry-module/commit/80de6b97fca02905a1fbe51ae5c9d0a536aaf5e1))
* **deps:** update sentry sdk to ^7.44.2 ([#527](https://github.com/nuxt-community/sentry-module/issues/527)) ([82d1f08](https://github.com/nuxt-community/sentry-module/commit/82d1f0821fc7391687675d3e3798666218599ede))
* **deps:** update sentry sdk to ^7.45.0 ([#531](https://github.com/nuxt-community/sentry-module/issues/531)) ([888b395](https://github.com/nuxt-community/sentry-module/commit/888b395584f8d8f2cd1a4c105946f7c6a944ba11))
* **tracing:** connect backend and frontend traces ([#529](https://github.com/nuxt-community/sentry-module/issues/529)) ([30c3127](https://github.com/nuxt-community/sentry-module/commit/30c3127be674614ff1528d77084fcc7822489f64))
### [7.1.4](https://github.com/nuxt-community/sentry-module/compare/v7.1.3...v7.1.4) (2023-03-07)
### [7.1.3](https://github.com/nuxt-community/sentry-module/compare/v7.1.2...v7.1.3) (2023-03-07)
### Bug Fixes
* **deps:** update sentry dependencies to ^7.41.0 ([#516](https://github.com/nuxt-community/sentry-module/issues/516)) ([b318fc3](https://github.com/nuxt-community/sentry-module/commit/b318fc3fea0309027615e2f384c0c4c211dc3001))
* **tracing:** initialize server side tracing correctly ([#517](https://github.com/nuxt-community/sentry-module/issues/517)) ([c7eda63](https://github.com/nuxt-community/sentry-module/commit/c7eda637da1c2526963e4a7b310c14f0882a83c2))
### [7.1.2](https://github.com/nuxt-community/sentry-module/compare/v7.1.1...v7.1.2) (2023-03-03)
### Bug Fixes
* **deps:** update sentry dependencies to ^7.40.0 ([#515](https://github.com/nuxt-community/sentry-module/issues/515)) ([ce402a4](https://github.com/nuxt-community/sentry-module/commit/ce402a4a3a20758cea5f11b0122b0c86c8e38fdd))
* **tracing:** automatically instrument server-side requests ([#514](https://github.com/nuxt-community/sentry-module/issues/514)) ([1d96f8b](https://github.com/nuxt-community/sentry-module/commit/1d96f8bb5c85d3c3247b518c97910cf32a8a268b))
* update list of allowed integrations and allow configuring them ([#513](https://github.com/nuxt-community/sentry-module/issues/513)) ([7933761](https://github.com/nuxt-community/sentry-module/commit/793376171fd00925eb8b09a4cd6d22609513e58d))
### [7.1.1](https://github.com/nuxt-community/sentry-module/compare/v7.1.0...v7.1.1) (2023-02-27)
### Bug Fixes
* **deps:** update sentry dependencies to ^7.39.0 ([#509](https://github.com/nuxt-community/sentry-module/issues/509)) ([46324d7](https://github.com/nuxt-community/sentry-module/commit/46324d737736b14f0ecb9d17dc0574c0ec85864c))
* Windows paths for custom client configuration files ([#510](https://github.com/nuxt-community/sentry-module/issues/510)) ([bdea5fd](https://github.com/nuxt-community/sentry-module/commit/bdea5fd8d42098a5bb03d84c9e00584b40d7e47d))
## [7.1.0](https://github.com/nuxt-community/sentry-module/compare/v7.0.4...v7.1.0) (2023-02-20)
### Features
* support HttpClient client integration ([#504](https://github.com/nuxt-community/sentry-module/issues/504)) ([24d4871](https://github.com/nuxt-community/sentry-module/commit/24d48719e3e2550941d2e664be25a4b5ace39c34))
### Bug Fixes
* **deps:** update sentry dependencies to ^7.38.0 ([#501](https://github.com/nuxt-community/sentry-module/issues/501)) ([4f8b727](https://github.com/nuxt-community/sentry-module/commit/4f8b727d108d0044c089d0098bcf77e22962e464))
### [7.0.4](https://github.com/nuxt-community/sentry-module/compare/v7.0.3...v7.0.4) (2023-02-17)
### Bug Fixes
* apply runtime config last, after merging tracing options ([#499](https://github.com/nuxt-community/sentry-module/issues/499)) ([f434ec4](https://github.com/nuxt-community/sentry-module/commit/f434ec47868b5ad0511f16dc5b50cb4d7760e39c))
* **deps:** update sentry dependencies to ^7.37.2 ([#493](https://github.com/nuxt-community/sentry-module/issues/493)) ([2306a9f](https://github.com/nuxt-community/sentry-module/commit/2306a9f67ebf10ba808e0abe755e78bf610d9e66))
* **docs:** use correct yarn upgrade command ([#494](https://github.com/nuxt-community/sentry-module/issues/494)) ([9614795](https://github.com/nuxt-community/sentry-module/commit/9614795af3a5aa9730a2fbf4346f1eb0f7010059))
### [7.0.3](https://github.com/nuxt-community/sentry-module/compare/v7.0.2...v7.0.3) (2023-01-25)
### Bug Fixes
* **deps:** update sentry dependencies to ^7.33.0 ([#487](https://github.com/nuxt-community/sentry-module/issues/487)) ([23fc7c1](https://github.com/nuxt-community/sentry-module/commit/23fc7c1c38230a92044b68fc9154c264335283da))
* don't require webpack dependency at runtime ([#492](https://github.com/nuxt-community/sentry-module/issues/492)) ([db79dd0](https://github.com/nuxt-community/sentry-module/commit/db79dd032e929b7953d7bd621fccc24b9e364a5f))
### [7.0.2](https://github.com/nuxt-community/sentry-module/compare/v7.0.1...v7.0.2) (2023-01-09)
### Bug Fixes
* **deps:** update sentry dependencies to ^7.29.0 ([#482](https://github.com/nuxt-community/sentry-module/issues/482)) ([96d7a8c](https://github.com/nuxt-community/sentry-module/commit/96d7a8c257be6f3dd625c80544704d91324f958f))
* not able to resolve un-hoisted client-side dependencies ([#486](https://github.com/nuxt-community/sentry-module/issues/486)) ([82071ce](https://github.com/nuxt-community/sentry-module/commit/82071cef777de3d92d145c54aa01febb6a07cb9d))
### [7.0.1](https://github.com/nuxt-community/sentry-module/compare/v7.0.0...v7.0.1) (2023-01-03)
### Bug Fixes
* more accurate type for `serverConfig` option ([#484](https://github.com/nuxt-community/sentry-module/issues/484)) ([95f9f4f](https://github.com/nuxt-community/sentry-module/commit/95f9f4fcb81d56298d9827add9edee112a814fd8))
## [7.0.0](https://github.com/nuxt-community/sentry-module/compare/v6.0.3...v7.0.0) (2022-12-21)
### ⚠ BREAKING CHANGES
* Refer to https://sentry.nuxtjs.org/guide/migration for migration guide.
### Features
* enable tree shaking of Sentry SDK debug code ([#481](https://github.com/nuxt-community/sentry-module/issues/481)) ([c38f666](https://github.com/nuxt-community/sentry-module/commit/c38f66673203d784c1f65a762772fafc5e4bc4be))
* support plugin path for clientConfig and serverConfig ([#477](https://github.com/nuxt-community/sentry-module/issues/477)) ([63e698a](https://github.com/nuxt-community/sentry-module/commit/63e698aea18d453fae733bc2551d1f185f892860))
* **tracing:** enable Vue Router instrumentation by default ([#476](https://github.com/nuxt-community/sentry-module/issues/476)) ([acb2aaf](https://github.com/nuxt-community/sentry-module/commit/acb2aaff6fa99cb35875ae61fe6df13154f99454))
* update Sentry SDK from v6 to v7 ([#461](https://github.com/nuxt-community/sentry-module/issues/461)) ([53bbeec](https://github.com/nuxt-community/sentry-module/commit/53bbeecb74ca11b8228769b7b2f1b02e35db5a3e))
### Bug Fixes
* **deps:** update sentry dependencies to ^7.28.0 ([#478](https://github.com/nuxt-community/sentry-module/issues/478)) ([877dce5](https://github.com/nuxt-community/sentry-module/commit/877dce58190d3b63142e42308934702338541b86))
* gracefully handle Nuxt versions without Runtime Config ([#472](https://github.com/nuxt-community/sentry-module/issues/472)) ([08d7e6c](https://github.com/nuxt-community/sentry-module/commit/08d7e6c8c1f38c519b4ed71bc46b5c39cdb4d89c))
### [6.0.3](https://github.com/nuxt-community/sentry-module/compare/v6.0.2...v6.0.3) (2022-12-13)
### Bug Fixes
* **tracing:** autoSessionTracking not working on the server-side ([#466](https://github.com/nuxt-community/sentry-module/issues/466)) ([67851ba](https://github.com/nuxt-community/sentry-module/commit/67851ba55df38ecdf60c8f7a3da57893e6acfc58))
* incorrect option name in the warning message ([#467](https://github.com/nuxt-community/sentry-module/issues/467)) ([b81b2cf](https://github.com/nuxt-community/sentry-module/commit/b81b2cfb5cbc2055499f5601525f0576b0ff5216))
* **deps:** update devdependency @sentry/webpack-plugin to ^1.20.0 ([#451](https://github.com/nuxt-community/sentry-module/issues/451)) ([e1fef90](https://github.com/nuxt-community/sentry-module/commit/e1fef907dfd2bae4348c9dcb5285cc0b156c8a78))
### [6.0.2](https://github.com/nuxt-community/sentry-module/compare/v6.0.1...v6.0.2) (2022-12-12)
### Bug Fixes
* **tracing:** merge user's tracing configuration ([#463](https://github.com/nuxt-community/sentry-module/issues/463)) ([a567f82](https://github.com/nuxt-community/sentry-module/commit/a567f82ace5a22425c63a807a9736408727227f2))
### [6.0.1](https://github.com/nuxt-community/sentry-module/compare/v6.0.0...v6.0.1) (2022-09-28)
### Bug Fixes
* **tracing:** set `tracesSampleRate` when `tracing` enabled ([#448](https://github.com/nuxt-community/sentry-module/issues/448)) ([fe6d511](https://github.com/nuxt-community/sentry-module/commit/fe6d5111726ac8acc250f83de8a0155fea6bff83)), closes [#447](https://github.com/nuxt-community/sentry-module/issues/447)
## [6.0.0](https://github.com/nuxt-community/sentry-module/compare/v5.1.7...v6.0.0) (2022-08-26)
### ⚠ BREAKING CHANGES
* The server-side `process.sentry` will be created slightly later than before WHEN running the "build" action. It will be created before the pages are built (on `build:compile` hook) while before it was available a bit earlier on `ready` hook (with an issue that it was not always able to pass the project version to Sentry).
* **options:** Remove deprecated `webpackConfig` option. Configure through the `publishRelease` option instead.
* **options:** Remove deprecated `attachCommits` and `repo` options. Those can now be set through the `publishRelease` option.
* **deps:** Don't ship with `@sentry/webpack-plugin` as a dependency. To use the "publishRelease" option, it's now necessary to manually install that package as a dev dependency.
### Features
* support for registering external integrations ([#276](https://github.com/nuxt-community/sentry-module/issues/276)) ([2cf56ef](https://github.com/nuxt-community/sentry-module/commit/2cf56ef81344bf5350eca530dc21d9b9044d1419))
### Bug Fixes
* **deps:** update devdependency @sentry/webpack-plugin to ^1.19.0 ([#434](https://github.com/nuxt-community/sentry-module/issues/434)) ([694ba04](https://github.com/nuxt-community/sentry-module/commit/694ba041203e10eb2c72679874d897dacaa1cc61))
* **deps:** update sentry dependencies ([#405](https://github.com/nuxt-community/sentry-module/issues/405)) ([a465f39](https://github.com/nuxt-community/sentry-module/commit/a465f39aa2ae1eff13969fb27fda28c01c316685))
* throw error instead of logging when @sentry/webpack-plugin missing ([d437a37](https://github.com/nuxt-community/sentry-module/commit/d437a379472e98d4dd660cd9920bb2c1bc578599))
* use different hook for initializing server-side Sentry instance ([#403](https://github.com/nuxt-community/sentry-module/issues/403)) ([20734fa](https://github.com/nuxt-community/sentry-module/commit/20734fabd9cd9aff5cd4eaa9ad3d69c96b85f6ae))
* **deps:** Don't ship with `@sentry/webpack-plugin` as a dependency ([#390](https://github.com/nuxt-community/sentry-module/issues/390)) ([b042a46](https://github.com/nuxt-community/sentry-module/commit/b042a469e3effc6f849839c652e404c807e07d8e))
* **deps:** update dependency @sentry/webpack-plugin to ^1.18.7 ([#392](https://github.com/nuxt-community/sentry-module/issues/392)) ([f72147f](https://github.com/nuxt-community/sentry-module/commit/f72147f4ce22836580e6bcac72a5314bd38c24e2))
* **deps:** update sentry dependencies ([#388](https://github.com/nuxt-community/sentry-module/issues/388)) ([5251cb6](https://github.com/nuxt-community/sentry-module/commit/5251cb64985c84dbed9841ea70bf5e6cf39ab5e9))
* **deps:** update sentry dependencies ([#396](https://github.com/nuxt-community/sentry-module/issues/396)) ([7fec526](https://github.com/nuxt-community/sentry-module/commit/7fec526df4afd9b28b61c57d52091bfadc70694f))
### Code Refactoring
* **options:** remove deprecated "attachCommits" and "repo" ([#393](https://github.com/nuxt-community/sentry-module/issues/393)) ([1efcd28](https://github.com/nuxt-community/sentry-module/commit/1efcd2850a117afd5c775b3864912e8552b971a5))
* **options:** remove deprecated "webpackConfig" ([#394](https://github.com/nuxt-community/sentry-module/issues/394)) ([859101e](https://github.com/nuxt-community/sentry-module/commit/859101ec0a17e50ff7c56551a47e9e0fa5b39992))
### [5.1.7](https://github.com/nuxt-community/sentry-module/compare/v5.1.6...v5.1.7) (2022-02-02)
### Bug Fixes
* **deps:** update sentry dependencies ([#379](https://github.com/nuxt-community/sentry-module/issues/379)) ([e7db004](https://github.com/nuxt-community/sentry-module/commit/e7db004716e3eeef3e990cd9410cdf68c6575408))
* don't pass empty object to integrations constructor ([#387](https://github.com/nuxt-community/sentry-module/issues/387)) ([b4b9415](https://github.com/nuxt-community/sentry-module/commit/b4b94151f13d46697efadab80e20574eba3ac968))
### [5.1.6](https://github.com/nuxt-community/sentry-module/compare/v5.1.5...v5.1.6) (2021-11-26)
### Bug Fixes
* **deps:** update sentry dependencies to ^6.14.3 ([#367](https://github.com/nuxt-community/sentry-module/issues/367)) ([7a38d27](https://github.com/nuxt-community/sentry-module/commit/7a38d277206739339b8cc703cf18c8e192e205af))
* **deps:** update sentry dependencies to ^6.15.0 ([#374](https://github.com/nuxt-community/sentry-module/issues/374)) ([77fcf74](https://github.com/nuxt-community/sentry-module/commit/77fcf745c070e8656280dcae6cc3d5b3e1aae11d))
* don't pass empty object to integrations constructor ([#376](https://github.com/nuxt-community/sentry-module/issues/376)) ([18e12c5](https://github.com/nuxt-community/sentry-module/commit/18e12c59305974e0777bb32bb5c3ad99d7867d06))
### [5.1.5](https://github.com/nuxt-community/sentry-module/compare/v5.1.4...v5.1.5) (2021-11-05)
### Bug Fixes
* **deps:** update sentry dependencies ([#355](https://github.com/nuxt-community/sentry-module/issues/355)) ([9d23a87](https://github.com/nuxt-community/sentry-module/commit/9d23a874e389f6e291359ffa30b7891eda0a69e0))
* **docs:** typo in the lazy-loading section ([#363](https://github.com/nuxt-community/sentry-module/issues/363)) ([dfcc0ab](https://github.com/nuxt-community/sentry-module/commit/dfcc0ab23d00cd6f94a69161bbdde1d1ba427e5b))
### [5.1.4](https://github.com/nuxt-community/sentry-module/compare/v5.1.3...v5.1.4) (2021-10-01)
### Bug Fixes
* **deps:** update sentry dependencies to ^6.13.2 ([#345](https://github.com/nuxt-community/sentry-module/issues/345)) ([e51a438](https://github.com/nuxt-community/sentry-module/commit/e51a4388d03461846ebd2c2dacef22cccd7048f6))
* shutdown Sentry instance after generate ([#353](https://github.com/nuxt-community/sentry-module/issues/353)) ([ee4c293](https://github.com/nuxt-community/sentry-module/commit/ee4c293ba3cd623726250c495901cb88e14299bf))
### [5.1.3](https://github.com/nuxt-community/sentry-module/compare/v5.1.2...v5.1.3) (2021-08-25)
### Bug Fixes
* lodash.merge import error on using runtime config ([acfff72](https://github.com/nuxt-community/sentry-module/commit/acfff728c2702f40fea2fb538fe5eeb3cdddfd5c))
### [5.1.2](https://github.com/nuxt-community/sentry-module/compare/v5.1.1...v5.1.2) (2021-08-19)
### Bug Fixes
* allow overriding all "webpackConfig" options ([#338](https://github.com/nuxt-community/sentry-module/issues/338)) ([bbc46d7](https://github.com/nuxt-community/sentry-module/commit/bbc46d7785c81a6ccce17b836a3ca9f03e29719d))
* allow overriding all webpackConfig setCommits options ([#337](https://github.com/nuxt-community/sentry-module/issues/337)) ([0ea6cbc](https://github.com/nuxt-community/sentry-module/commit/0ea6cbc0a7796921c875b098a7887ef9dbcaf090))
* **types:** use BrowserOptions interface for clientConfig option ([#335](https://github.com/nuxt-community/sentry-module/issues/335)) ([1372a28](https://github.com/nuxt-community/sentry-module/commit/1372a283f6f1081499542292863f99b3b6b7d885))
### [5.1.1](https://github.com/nuxt-community/sentry-module/compare/v5.1.0...v5.1.1) (2021-08-10)
### Bug Fixes
* **deps:** update sentry dependencies ([#309](https://github.com/nuxt-community/sentry-module/issues/309)) ([844fb57](https://github.com/nuxt-community/sentry-module/commit/844fb57bdb088a91ba08f64c7b6af17bb569ab43))
## [5.1.0](https://github.com/nuxt-community/sentry-module/compare/v5.0.3...v5.1.0) (2021-05-28)
### Features
* allow disabling automatic version detection for releases ([#314](https://github.com/nuxt-community/sentry-module/issues/314)) ([e1677fa](https://github.com/nuxt-community/sentry-module/commit/e1677fa74a808e5ab6004f693fd36da4d1b9efef))
### Bug Fixes
* serialize regexpes properly in the server-side config ([#308](https://github.com/nuxt-community/sentry-module/issues/308)) ([9e3ae22](https://github.com/nuxt-community/sentry-module/commit/9e3ae221a7d339436abf01fead73228f3175b4d8)), closes [#307](https://github.com/nuxt-community/sentry-module/issues/307)
* **deps:** update dependency @sentry/webpack-plugin to ^1.15.0 ([#305](https://github.com/nuxt-community/sentry-module/issues/305)) ([a0396b6](https://github.com/nuxt-community/sentry-module/commit/a0396b69ccd1a8d8e2105f874e546ebc95401170))
* handle commonjs/es import styles for @sentry/cli ([#302](https://github.com/nuxt-community/sentry-module/issues/302)) ([d6a818d](https://github.com/nuxt-community/sentry-module/commit/d6a818dd7ed549537285beb8c44a1276a76fcfb9))
* **deps:** update sentry dependencies to ^6.2.5 ([#300](https://github.com/nuxt-community/sentry-module/issues/300)) ([faf6f67](https://github.com/nuxt-community/sentry-module/commit/faf6f67300f2ae89124f3a75e9a91db3763fe798))
* **docs:** fixes typography & content styling ([#288](https://github.com/nuxt-community/sentry-module/issues/288)) ([744bafb](https://github.com/nuxt-community/sentry-module/commit/744bafbeb55741ffeef93c6c62f2d73ef4e93037))
### [5.0.3](https://github.com/nuxt-community/sentry-module/compare/v5.0.2...v5.0.3) (2021-03-18)
### Bug Fixes
* crash on lazy loading when using Runtime Config ([#286](https://github.com/nuxt-community/sentry-module/issues/286)) ([074bf77](https://github.com/nuxt-community/sentry-module/commit/074bf77fa5f3a9afdb8c7a198c0a74dd6db416b9))
### [5.0.2](https://github.com/nuxt-community/sentry-module/compare/v5.0.1...v5.0.2) (2021-02-17)
### Bug Fixes
* support configuring "CaptureConsole" and "Debug" integrations ([#275](https://github.com/nuxt-community/sentry-module/issues/275)) ([73c5b12](https://github.com/nuxt-community/sentry-module/commit/73c5b12fcf8e8bd169eaf1fd559808553c2a9f39)), closes [#274](https://github.com/nuxt-community/sentry-module/issues/274)
### [5.0.1](https://github.com/nuxt-community/sentry-module/compare/v5.0.0...v5.0.1) (2021-02-08)
### Bug Fixes
* better handling of functions options in config ([#267](https://github.com/nuxt-community/sentry-module/issues/267)) ([341bed5](https://github.com/nuxt-community/sentry-module/commit/341bed57a2abd79b69d0c6474afaaa77b363674f))
## [5.0.0](https://github.com/nuxt-community/sentry-module/compare/v4.5.0...v5.0.0) (2021-01-21)
### ⚠ BREAKING CHANGES
* **deps:** This major version release doesn't contain any breaking API/code changes.
Starting with this version sessions data will be sent by default. See [Release Health](https://docs.sentry.io/product/releases/health/) docs to learn more.
You can opt-out of this behavior by setting `autoSessionTracking` option to `false`, for example:
```js
sentry: {
config: {
autoSessionTracking: false
}
}
```
### Features
* Add runtime config support ([#254](https://github.com/nuxt-community/sentry-module/issues/254)) ([7f8b373](https://github.com/nuxt-community/sentry-module/commit/7f8b373a0ec5024fcd2c4ec40b5e01eae8281005))
### Bug Fixes
* **deps:** update sentry deps to v6 (major) ([#265](https://github.com/nuxt-community/sentry-module/issues/265)) ([7316f05](https://github.com/nuxt-community/sentry-module/commit/7316f052b7b05cf71826135230085bb4b33c3a5f))
* **types:** add missing TS types for lazy-loading feature ([#262](https://github.com/nuxt-community/sentry-module/issues/262)) ([4a57102](https://github.com/nuxt-community/sentry-module/commit/4a571023c9779e289d14ae37377321a4cd589fec)), closes [#261](https://github.com/nuxt-community/sentry-module/issues/261)
* support overriding integrations from @sentry/browser ([#257](https://github.com/nuxt-community/sentry-module/issues/257)) ([ae75bee](https://github.com/nuxt-community/sentry-module/commit/ae75beedccd12e144df8af5f695fda45caa83ff9)), closes [#251](https://github.com/nuxt-community/sentry-module/issues/251)
## [4.5.0](https://github.com/nuxt-community/sentry-module/compare/v4.4.0...v4.5.0) (2020-11-11)
### Features
* add support for performance monitoring/tracing ([#250](https://github.com/nuxt-community/sentry-module/issues/250)) ([6a6a3be](https://github.com/nuxt-community/sentry-module/commit/6a6a3be408fbf559ecdcda9db659fcae3c9fdce9)), closes [#224](https://github.com/nuxt-community/sentry-module/issues/224)
### Bug Fixes
* **deps:** update sentry dependencies ^5.27.2 -> ^5.27.3 ([#249](https://github.com/nuxt-community/sentry-module/issues/249)) ([c9c4dde](https://github.com/nuxt-community/sentry-module/commit/c9c4dde53342646fbe5e90daeed9900ff8b97246))
## [4.4.0](https://github.com/nuxt-community/sentry-module/compare/v4.3.5...v4.4.0) (2020-11-04)
### Features
* allow config to be passed to requestHandler ([#243](https://github.com/nuxt-community/sentry-module/issues/243)) ([9daaf4b](https://github.com/nuxt-community/sentry-module/commit/9daaf4b9d0852f9da7cef5f98b3a362fca21a80c))
### [4.3.5](https://github.com/nuxt-community/sentry-module/compare/v4.3.4...v4.3.5) (2020-09-16)
### Bug Fixes
* initialize server-side Sentry when using Nuxt programmatically ([#235](https://github.com/nuxt-community/sentry-module/issues/235)) ([575e4db](https://github.com/nuxt-community/sentry-module/commit/575e4db0b29438494be4f27cb0d710046622e73f)), closes [#230](https://github.com/nuxt-community/sentry-module/issues/230)
* **deps:** update Sentry dependency from 5.20.1 to 5.23.0 ([#223](https://github.com/nuxt-community/sentry-module/issues/223)) ([9894b02](https://github.com/nuxt-community/sentry-module/commit/9894b02fbe0c8f115b07cd4b8e70992d48e0825e))
### [4.3.4](https://github.com/nuxt-community/sentry-module/compare/v4.3.3...v4.3.4) (2020-08-01)
### Bug Fixes
* **lazy:** improve error reporting for postponed global errors ([#220](https://github.com/nuxt-community/sentry-module/issues/220)) ([ecf5d00](https://github.com/nuxt-community/sentry-module/commit/ecf5d006e194cba218bec00f980b651b9c964ded)), closes [/github.com/getsentry/sentry-javascript/blob/9428c9a171a0c6ddcf24935fd03d6492feea0343/packages/browser/src/loader.js#L135-L147](https://github.com/nuxt-community//github.com/getsentry/sentry-javascript/blob/9428c9a171a0c6ddcf24935fd03d6492feea0343/packages/browser/src/loader.js/issues/L135-L147)
### [4.3.3](https://github.com/nuxt-community/sentry-module/compare/v4.3.2...v4.3.3) (2020-07-30)
### Bug Fixes
* **lazy:** crash on iterating "delayedCalls" ([#219](https://github.com/nuxt-community/sentry-module/issues/219)) ([a3de1cf](https://github.com/nuxt-community/sentry-module/commit/a3de1cfc6d108487d616ebff203805e74bc59301))
### [4.3.2](https://github.com/nuxt-community/sentry-module/compare/v4.3.1...v4.3.2) (2020-07-29)
### Bug Fixes
* crash on enabling publishRelease with no "release" ([#217](https://github.com/nuxt-community/sentry-module/issues/217)) ([92e7680](https://github.com/nuxt-community/sentry-module/commit/92e7680b533f14459741c238845a80c213f032fb)), closes [#200](https://github.com/nuxt-community/sentry-module/issues/200)
### [4.3.1](https://github.com/nuxt-community/sentry-module/compare/v4.3.0...v4.3.1) (2020-07-29)
### Bug Fixes
* crash on running module outside of git repo when release not set ([#216](https://github.com/nuxt-community/sentry-module/issues/216)) ([8b00082](https://github.com/nuxt-community/sentry-module/commit/8b00082d6e209615971b89ec26835409cc975819)), closes [#200](https://github.com/nuxt-community/sentry-module/issues/200)
## [4.3.0](https://github.com/nuxt-community/sentry-module/compare/v4.2.1...v4.3.0) (2020-07-28)
### Features
* add types for module configuration ([#213](https://github.com/nuxt-community/sentry-module/issues/213)) ([8236472](https://github.com/nuxt-community/sentry-module/commit/8236472545007c5968a88a6123f1b133c826e87a))
### Bug Fixes
* enable console logging of Vue errors in development ([#214](https://github.com/nuxt-community/sentry-module/issues/214)) ([55b7efe](https://github.com/nuxt-community/sentry-module/commit/55b7efedf149627b2ef4252cd83cd8f48da36e45))
* infer "config.release" automatically if not provided ([#205](https://github.com/nuxt-community/sentry-module/issues/205)) ([059f4e9](https://github.com/nuxt-community/sentry-module/commit/059f4e958c3035bd41db875bc282e41660394468))
### [4.2.1](https://github.com/nuxt-community/sentry-module/compare/v4.2.0...v4.2.1) (2020-07-27)
### Bug Fixes
* user's integrations options not respected on the client ([#208](https://github.com/nuxt-community/sentry-module/issues/208)) ([b81c7d3](https://github.com/nuxt-community/sentry-module/commit/b81c7d3ec2809e62dbf9d1d04053671dd8e21701)), closes [#207](https://github.com/nuxt-community/sentry-module/issues/207)
## [4.2.0](https://github.com/nuxt-community/sentry-module/compare/v4.1.3...v4.2.0) (2020-07-27)
### Features
* support lazy loading of Sentry on the client ([#198](https://github.com/nuxt-community/sentry-module/issues/198)) ([963fead](https://github.com/nuxt-community/sentry-module/commit/963fead523d94661dfc4c597866db66408b7a667)), closes [#127](https://github.com/nuxt-community/sentry-module/issues/127)
### [4.1.3](https://github.com/nuxt-community/sentry-module/compare/v4.1.2...v4.1.3) (2020-07-01)
### Bug Fixes
* **deps:** update Sentry dependencies to v5.18.1 ([#194](https://github.com/nuxt-community/sentry-module/issues/194)) ([39304b5](https://github.com/nuxt-community/sentry-module/commit/39304b50052628cab66d9c67ab30e1e132f3f30a))
### [4.1.2](https://github.com/nuxt-community/sentry-module/compare/v4.1.1...v4.1.2) (2020-06-08)
### Bug Fixes
* **deps:** update Sentry dependencies to ^5.17.0 ([#189](https://github.com/nuxt-community/sentry-module/issues/189)) ([0f98c51](https://github.com/nuxt-community/sentry-module/commit/0f98c513bdad3dd44f174036197fff8d4688345d))
### [4.1.1](https://github.com/nuxt-community/sentry-module/compare/v4.1.0...v4.1.1) (2020-06-08)
### Bug Fixes
* **deps:** move @nuxtjs/eslint-config-typescript to devDependencies ([98bab95](https://github.com/nuxt-community/sentry-module/commit/98bab95b507e587e7cd390326c454b252edfb85f))
## [4.1.0](https://github.com/nuxt-community/sentry-module/compare/v4.0.3...v4.1.0) (2020-06-08)
### Features
* add an option to toggle logging of calls on mocked instance ([#187](https://github.com/nuxt-community/sentry-module/issues/187)) ([6a1692e](https://github.com/nuxt-community/sentry-module/commit/6a1692e2332da31ac7becafa34eca76678df11da)), closes [#176](https://github.com/nuxt-community/sentry-module/issues/176)
### Bug Fixes
* **deps:** update sentry dependencies to v5.16.1 ([#180](https://github.com/nuxt-community/sentry-module/issues/180)) ([a42035f](https://github.com/nuxt-community/sentry-module/commit/a42035fd149586be293416b2aecac78e9ca49c8a))
* properly log state of the Sentry reporting ([#186](https://github.com/nuxt-community/sentry-module/issues/186)) ([36fde1a](https://github.com/nuxt-community/sentry-module/commit/36fde1ad3c4259c916bf21e1af05d417846a1958))
### [4.0.3](https://github.com/nuxt-community/sentry-module/compare/v4.0.2...v4.0.3) (2020-05-04)
### Bug Fixes
* allow overriding webpackConfig urlPrefix ([#178](https://github.com/nuxt-community/sentry-module/issues/178)) ([c52694e](https://github.com/nuxt-community/sentry-module/commit/c52694ee35c54d6d027f4855815aa5870ba5899e))
### [4.0.2](https://github.com/nuxt-community/sentry-module/compare/v4.0.1...v4.0.2) (2020-04-23)
### Bug Fixes
* set public path correctly when building on Windows ([#174](https://github.com/nuxt-community/sentry-module/issues/174)) ([b8b811a](https://github.com/nuxt-community/sentry-module/commit/b8b811a6ce3f3603bcb8d49ec737a6700b4a2f07))
### [4.0.1](https://github.com/nuxt-community/sentry-module/compare/v4.0.0...v4.0.1) (2020-04-15)
## [4.0.0](https://github.com/nuxt-community/sentry-module/compare/v3.3.1...v4.0.0) (2020-03-24)
### ⚠ BREAKING CHANGES
* Requires at least Nuxt v2.10.0
### Bug Fixes
* **deps:** update Sentry dependencies to v5.15.0 ([#166](https://github.com/nuxt-community/sentry-module/issues/166)) ([ebea3ca](https://github.com/nuxt-community/sentry-module/commit/ebea3ca5364f5b1499a9f88e4f6873243e514ed0))
* properly handle publishing when custom webpack config is added ([#167](https://github.com/nuxt-community/sentry-module/issues/167)) ([ca2f680](https://github.com/nuxt-community/sentry-module/commit/ca2f680635996d3cc08ff1783e7cb59af28a91b4))
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [3.3.1](https://github.com/nuxt-community/sentry-module/compare/v3.3.0...v3.3.1) (2020-03-06)
## [3.3.0](https://github.com/nuxt-community/sentry-module/compare/v3.2.4...v3.3.0) (2020-02-27)
### Features
* add sourceMapStyle option ([#158](https://github.com/nuxt-community/sentry-module/issues/158)) ([450bf75](https://github.com/nuxt-community/sentry-module/commit/450bf75f6586877f618bc7ad2a0e560e3d3fc861)), closes [#157](https://github.com/nuxt-community/sentry-module/issues/157)
### Bug Fixes
* **deps:** update Sentry dependencies to v5.12.5 ([#154](https://github.com/nuxt-community/sentry-module/issues/154)) ([34203a6](https://github.com/nuxt-community/sentry-module/commit/34203a6cf981e8e6b2daaeea4b0acd3957df15f5))
### [3.2.4](https://github.com/nuxt-community/sentry-module/compare/v3.2.3...v3.2.4) (2020-02-14)
### Bug Fixes
* released client sourcemaps don't have correct prefix (no /_nuxt/) ([#155](https://github.com/nuxt-community/sentry-module/issues/155)) ([2c8bc83](https://github.com/nuxt-community/sentry-module/commit/2c8bc833d531ca843b4c9bc878ade5b1a49891db))
### [3.2.3](https://github.com/nuxt-community/sentry-module/compare/v3.2.2...v3.2.3) (2020-02-13)
### Bug Fixes
* allow string to webpackConfig.include ([#149](https://github.com/nuxt-community/sentry-module/issues/149)) ([146ff20](https://github.com/nuxt-community/sentry-module/commit/146ff206153792d80c9e460d75b60e99d80d581d))
* don't set urlPrefix for release on server ([#150](https://github.com/nuxt-community/sentry-module/issues/150)) ([8e3e4d1](https://github.com/nuxt-community/sentry-module/commit/8e3e4d1c8289a8abae7337bbca8362da6fc5c1b9))
* don't use Proxy to avoid problems with IE11 compatibility ([f78d7b6](https://github.com/nuxt-community/sentry-module/commit/f78d7b6a4838b45f4fe5b73ee0a1b0f548018824)), closes [#144](https://github.com/nuxt-community/sentry-module/issues/144)
* enable source maps on server also ([c71d848](https://github.com/nuxt-community/sentry-module/commit/c71d8488c2b017dcdc2ecdb560b53fe5f4f671f4))
* release failure with non-standard directory structure ([215c308](https://github.com/nuxt-community/sentry-module/commit/215c30842bcedef18c1d8485f20cdf0293701897)), closes [#132](https://github.com/nuxt-community/sentry-module/issues/132)
* router.base not taken into account when releasing source maps ([#152](https://github.com/nuxt-community/sentry-module/issues/152)) ([8ffce3a](https://github.com/nuxt-community/sentry-module/commit/8ffce3acc00a0314bed0b168d05ae33597515306)), closes [#105](https://github.com/nuxt-community/sentry-module/issues/105)
* **types:** add types for process.sentry ([#153](https://github.com/nuxt-community/sentry-module/issues/153)) ([0ff5969](https://github.com/nuxt-community/sentry-module/commit/0ff59695103c613d21956add54c15b12144de526))
### [3.2.2](https://github.com/nuxt-community/sentry-module/compare/v3.2.1...v3.2.2) (2020-02-03)
### Bug Fixes
* **types:** use @sentry/minimal instead of @sentry/types ([#142](https://github.com/nuxt-community/sentry-module/issues/142)) ([de1874c](https://github.com/nuxt-community/sentry-module/commit/de1874cc3744052bef702f7c33f484c84b409119))
### [3.2.1](https://github.com/nuxt-community/sentry-module/compare/v3.2.0...v3.2.1) (2020-01-31)
### Bug Fixes
* **types:** Make $sentry non-optional since the Proxy is now used when disabled ([238a68d](https://github.com/nuxt-community/sentry-module/commit/238a68d8a540f5410dbb4ffb604d036cef0b8bed))
## [3.2.0](https://github.com/nuxt-community/sentry-module/compare/v3.1.1...v3.2.0) (2020-01-31)
### Features
* mock sentry in case it is disabled ([da106ab](https://github.com/nuxt-community/sentry-module/commit/da106ab9c40a37173e0f0b43ab3899c545ef225d))
### [3.0.1](https://github.com/nuxt-community/sentry-module/compare/v3.0.0...v3.0.1) (2019-10-14)
## [3.0.0](https://github.com/nuxt-community/sentry-module/compare/v2.3.2...v3.0.0) (2019-05-12)
### Features
* sentry 5 update, plugin for server side, ([#72](https://github.com/nuxt-community/sentry-module/issues/72)) ([17322f9](https://github.com/nuxt-community/sentry-module/commit/17322f9))
### Bug Fixes
* fix typo in sentry.client ([#81](https://github.com/nuxt-community/sentry-module/issues/81)) ([77a8f23](https://github.com/nuxt-community/sentry-module/commit/77a8f23))
* **client:** client not being initialized ([#78](https://github.com/nuxt-community/sentry-module/issues/78)) ([a68f34b](https://github.com/nuxt-community/sentry-module/commit/a68f34b))
## [2.3.2](https://github.com/nuxt-community/sentry-module/compare/v2.3.1...v2.3.2) (2019-04-02)
### Bug Fixes
* fix module options ([#59](https://github.com/nuxt-community/sentry-module/issues/59)) ([9b4d723](https://github.com/nuxt-community/sentry-module/commit/9b4d723))
## [2.3.1](https://github.com/nuxt-community/sentry-module/compare/v2.3.0...v2.3.1) (2019-02-20)
<a name="2.1.0"></a>
# [2.1.0](https://github.com/nuxt-community/sentry-module/compare/v2.0.0...v2.1.0) (2018-11-27)
### Bug Fixes
* change example of sentry command to valid ([6c9e862](https://github.com/nuxt-community/sentry-module/commit/6c9e862))
### Features
* add browser integrations ([8f11ea7](https://github.com/nuxt-community/sentry-module/commit/8f11ea7))
<a name="2.0.0"></a>
# [2.0.0](https://github.com/nuxt-community/sentry-module/compare/v1.1.3...v2.0.0) (2018-10-19)
### Features
* use new sentry sdk, close [#20](https://github.com/nuxt-community/sentry-module/issues/20), [#30](https://github.com/nuxt-community/sentry-module/issues/30) ([da63340](https://github.com/nuxt-community/sentry-module/commit/da63340))
<a name="1.1.3"></a>
## [1.1.3](https://github.com/nuxt-community/sentry-module/compare/v1.1.2...v1.1.3) (2018-09-10)
### Bug Fixes
* disabled option, fixes [#29](https://github.com/nuxt-community/sentry-module/issues/29) ([dbb2227](https://github.com/nuxt-community/sentry-module/commit/dbb2227))
<a name="1.1.2"></a>
## [1.1.2](https://github.com/nuxt-community/sentry-module/compare/v1.1.1...v1.1.2) (2018-08-17)
### Features
* Add new option "disabled" ([0a8a047](https://github.com/nuxt-community/sentry-module/commit/0a8a047))
<a name="1.1.1"></a>
## [1.1.1](https://github.com/nuxt-community/sentry-module/compare/v1.1.0...v1.1.1) (2018-07-12)
### Features
* add fallback for deprecated dns ([#24](https://github.com/nuxt-community/sentry-module/issues/24)) ([9f47f6a](https://github.com/nuxt-community/sentry-module/commit/9f47f6a))
* updated logging to use consola ([#25](https://github.com/nuxt-community/sentry-module/issues/25)) ([f6abcc8](https://github.com/nuxt-community/sentry-module/commit/f6abcc8))
<a name="1.1.0"></a>
# [1.1.0](https://github.com/nuxt-community/sentry-module/compare/v1.0.3...v1.1.0) (2018-06-26)
### Features
* capture errors during nuxt generate ([129cb0f](https://github.com/nuxt-community/sentry-module/commit/129cb0f))
<a name="1.0.3"></a>
## [1.0.3](https://github.com/nuxt-community/sentry-module/compare/v1.0.2...v1.0.3) (2018-03-22)
<a name="1.0.2"></a>
## [1.0.2](https://github.com/nuxt-community/sentry-module/compare/v1.0.1...v1.0.2) (2018-03-18)
### Bug Fixes
* env bool now parsed as bool instead of string, close [#13](https://github.com/nuxt-community/sentry-module/issues/13) ([849e1e8](https://github.com/nuxt-community/sentry-module/commit/849e1e8))
* plugin is not loaded if no keys are provided, fix [#14](https://github.com/nuxt-community/sentry-module/issues/14) ([3e62730](https://github.com/nuxt-community/sentry-module/commit/3e62730))
<a name="1.0.1"></a>
## [1.0.1](https://github.com/nuxt-community/sentry-module/compare/v1.0.0...v1.0.1) (2018-01-27)
<a name="1.0.0"></a>
# [1.0.0](https://github.com/nuxt-community/sentry-module/compare/v0.2.0...v1.0.0) (2018-01-16)
### Features
* Support nuxt 1.0 new hook system ([85bf6d0](https://github.com/nuxt-community/sentry-module/commit/85bf6d0))
<a name="0.2.0"></a>
# [0.2.0](https://github.com/nuxt-community/sentry-module/compare/v0.1.1...v0.2.0) (2017-12-13)
<a name="0.1.1"></a>
## [0.1.1](https://github.com/nuxt-community/sentry-module/compare/v0.1.0...v0.1.1) (2017-11-28)
<a name="0.1.0"></a>
# [0.1.0](https://github.com/nuxt-community/sentry-module/compare/v0.0.2...v0.1.0) (2017-10-24)
### Features
* more options ([cbca975](https://github.com/nuxt-community/sentry-module/commit/cbca975))
<a name="0.0.2"></a>
## [0.0.2](https://github.com/nuxt-community/sentry-module/compare/v0.0.1...v0.0.2) (2017-10-17)
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) Diederik van den Burger <diederik@webrelated.nl>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
[](https://sentry.nuxtjs.org)
# @nuxtjs/sentry
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Standard JS][standard-js-src]][standard-js-href]
> [Sentry](http://sentry.io) module for [Nuxt 2](https://v2.nuxt.com/). For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
- [✨ Release Notes](https://sentry.nuxtjs.org/releases)
- [📖 Documentation](https://sentry.nuxtjs.org)
## Contributing
1. Install dependencies with `yarn`.
2. Run `yarn dev:prepare` to generate stubbed `dist` directory.
3. Make your changes.
4. Run `yarn lint` and `yarn test` to verify that there is no issues (consider adding new test for your changes).
5. Submit a PR.
## License
[MIT License](./LICENSE)
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/dt/@nuxtjs/sentry.svg?style=flat-square
[npm-version-href]: https://npmjs.com/package/@nuxtjs/sentry
[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/sentry/latest.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/sentry
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square
[standard-js-href]: https://standardjs.com
================================================
FILE: build.config.ts
================================================
import { defineBuildConfig } from 'unbuild'
export default defineBuildConfig({
entries: [
{
builder: 'mkdist',
input: './src/templates/',
outDir: './dist/templates',
ext: 'js',
declaration: false,
},
],
externals: [
'@nuxt/types',
'@sentry/browser',
'@sentry/cli',
'@sentry/core',
'@sentry/node',
'@sentry/profiling-node',
'@sentry/types',
'@sentry/webpack-plugin',
'consola',
'hash-sum',
'hookable',
'pathe',
'webpack',
'vuex',
],
})
================================================
FILE: docs/.gitignore
================================================
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
dist
sw.*
.env
================================================
FILE: docs/.nvmrc
================================================
20
================================================
FILE: docs/README.md
================================================
# docs
## Setup
Install dependencies:
```bash
yarn install
```
## Development
```bash
yarn dev
```
## Static Generation
This will create the `dist/` directory for publishing to static hosting:
```bash
yarn generate
```
To preview the static generated app, run `yarn start`
For detailed explanation on how things work, checkout [nuxt/content](https://content.nuxtjs.org) and [@nuxt/content theme docs](https://content.nuxtjs.org/themes-docs).
================================================
FILE: docs/content/en/configuration/options.md
================================================
---
title: Options
description: 'Options can be passed to Sentry using either environment variables'
position: 15
category: Configuration
---
<alert type="info">
This module is for Nuxt 2. For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
</alert>
Options can be passed using either:
- environment variables
- `sentry` object in `nuxt.config.js`
- when registering the module: `modules: [['@nuxtjs/sentry', {/*options*/}]]`
The `config`, `serverConfig` and `clientConfig` options can also be configured using [Runtime Config](/configuration/runtime-config).
The `dsn` is the only option that is required to enable Sentry reporting.
### dsn
- Type: `String`
- Default: `process.env.SENTRY_DSN || ''`
- If no `dsn` is provided then Sentry will be initialized using mocked instance to prevent the code that references `$sentry` from crashing. No errors will be reported using that mocked instance.
### lazy
- Type: `Boolean` or `Object`
- Default: `false`
- Load Sentry lazily so it's not included in your main bundle
- If `true` then the default options will be used:
```js
{
injectMock: true,
injectLoadHook: false,
mockApiMethods: true,
chunkName: 'sentry',
webpackPrefetch: false,
webpackPreload: false
}
```
- Options:
- **injectMock**
- Type: `Boolean`
- Default: `true`
- Whether a Sentry mock needs to be injected that captures any calls to `$sentry` API methods while Sentry has not yet loaded. Captured API method calls are executed once Sentry is loaded
> When `injectMock: true` this module will also add a window.onerror listener. If errors are captured before Sentry has loaded then these will be reported once Sentry has loaded using sentry.captureException
```js [pages/index.vue]
beforeMount() {
// onNuxtReady is called _after_ the Nuxt.js app is fully mounted,
// so Sentry is not yet loaded when beforeMount is called
// But when you set injectMock: true this call will be captured
// and executed after Sentry has loaded
this.$sentry.captureMessage('Hello!')
},
```
- **injectLoadHook**
- Type: `Boolean`
- Default: `false`
- By default Sentry will be lazy loaded once `window.onNuxtReady` is called. If you want to explicitly control when Sentry will be loaded you can set `injectLoadHook: true`. The module will inject a `$sentryLoad` method into the Nuxt.js context which you need to call once you are ready to load Sentry
```js [layouts/default.vue]
...
mounted() {
// Only load Sentry after initial page has fully loaded
// (this example should behave similar to using window.onNuxtReady though)
this.$nextTick(() => this.$sentryLoad())
}
```
- **mockApiMethods**
- Type: `Boolean` or `Array`
- Default `true`
- Which API methods from `@sentry/vue` should be mocked. You can use this to only mock methods you really use.
- This option is ignored when `injectMock: false`
- If `mockApiMethods: true` then all available API methods will be mocked
> If `injectMock: true` then _captureException_ will always be mocked for use with the window.onerror listener
```js [nuxt.config.js]
sentry: {
lazy: {
mockApiMethods: ['captureMessage']
}
}
```
```js [pages/index.vue]
mounted() {
this.$sentry.captureMessage('This works!')
this.$sentry.captureEvent({
message: `
This will throw an error because
captureEvent doesn't exists on the mock
`
})
// To circumvent this problem you could use $sentryReady
(await this.$sentryReady()).captureEvent({
message: `
This will not throw an error because
captureEvent is only executed after
Sentry has been loaded
`
})
}
```
- **chunkName**
- Type: `String`
- Default: `'sentry'`
- The _webpackChunkName_ to use, see [Webpack Magic Comments](https://webpack.js.org/API/module-methods/#magic-comments)
- **webpackPrefetch**
- Type: `Boolean`
- Default: `false`
- Whether the Sentry chunk should be prefetched
- **webpackPreload**
- Type: `Boolean`
- Default: `false`
- Whether the Sentry chunk should be preloaded
### runtimeConfigKey
- Type: `String`
- Default: `sentry`
- Specified object in Nuxt config in `publicRuntimeConfig[runtimeConfigKey]` will override some options at runtime. See documentation at https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-runtime-config/
- Used to define the environment at runtime for example
- See also [Runtime Config](/configuration/runtime-config) documentation.
### disabled
- Type: `Boolean`
- Default: `process.env.SENTRY_DISABLED || false`
- Sentry will not be initialized if set to `true`.
### disableClientSide
- Type: `Boolean`
- Default: `process.env.SENTRY_DISABLE_CLIENT_SIDE || false`
### disableServerSide
- Type: `Boolean`
- Default: `process.env.SENTRY_DISABLE_SERVER_SIDE || false`
### initialize
- Type: `Boolean`
- Default: `process.env.SENTRY_INITIALIZE || true`
- Can be used to add the `$sentry` object without initializing it, which will result in not reporting errors to Sentry when they happen but not crashing on calling the Sentry APIs.
### logMockCalls
- Type: `Boolean`
- Default: `true`
- Whether to log calls to the mocked `$sentry` object in the console
- Only applies when mocked instance is used (when `disabled`, `disableClientSide` or `disableServerSide` is `true`)
### publishRelease
<alert type="info">
`@sentry/webpack-plugin@2` package must be installed manually as a dev dependency to be able to publish releases.
</alert>
- Type: `Boolean` or [`SentryWebpackPluginOptions`](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/packages/bundler-plugin-core/src/types.ts)
- Default: `process.env.SENTRY_PUBLISH_RELEASE || false`
- Enables Sentry releases for better debugging using source maps. Uses [@sentry/webpack-plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/).
- Publishing releases requires the organization slug, project name and the Sentry authentication token to be provided. Those can be provided either via an object value or [environment variables or a properties file](https://docs.sentry.io/product/cli/configuration/#sentry-cli-working-with-projects). So for example, when using the object value, you'd set `authToken`, `org` and `project` options, and when using the environment variables you'd set `SENTRY_AUTH_TOKEN`, `SENTRY_ORG` and `SENTRY_PROJECT`.
- It's recommended to pass an object value to this option rather than using the boolean `true`. When using the boolean, you have to provide all required options through other means mentioned above.
- The releases are only published when this option is enabled and at the same time you are NOT running in development (`nuxt dev`) mode.
- See https://docs.sentry.io/workflow/releases for more information. Note that the Sentry CLI options mentioned in the documentation typically have a [@sentry/webpack-plugin](https://github.com/getsentry/sentry-javascript-bundler-plugins/) equivalent.
Example configuration:
```js
sentry: {
// ...
publishRelease: {
authToken: '<token>',
org: 'MyCompany',
project: 'my-project',
release: {
// Attach commits to the release (requires that the build triggered within a git repository).
setCommits: {
auto: true
}
}
}
}
```
- module by default includes all js/map assets generated during the build step.
### sourceMapStyle
- Type: `String`
- Default: `hidden-source-map`
- Only has an effect when `publishRelease` is enabled
- The type of source maps generated when publishing release to Sentry. See https://webpack.js.org/configuration/devtool for a list of available options
### disableServerRelease
- Type: `Boolean`
- Default: `process.env.SENTRY_DISABLE_SERVER_RELEASE || false`
- Only has an effect when `publishRelease` is enabled
- See https://docs.sentry.io/workflow/releases for more information
### disableClientRelease
- Type: `Boolean`
- Default: `process.env.SENTRY_DISABLE_CLIENT_RELEASE || false`
- Only has an effect when `publishRelease` is enabled
- See https://docs.sentry.io/workflow/releases for more information
### clientIntegrations
- Type: `Object`
- Default:
```js
{
ExtraErrorData: {},
ReportingObserver: { types: ['crash'] },
}
```
- Sentry by default also enables the following browser integrations: `Breadcrumbs`, `Dedupe`, `FunctionToString`, `GlobalHandlers`, `HttpContext`, `InboundFilters`, `LinkedErrors`, `TryCatch`.
- When `tracing` option is enabled then the [Vue Router Instrumentation](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) is also enabled.
- The full list of client integrations that are supported: `Breadcrumbs`, `CaptureConsole`, `ContextLines`, `Debug`, `Dedupe`, `ExtraErrorData`, `FunctionToString`, `GlobalHandlers`, `HttpClient`, `HttpContext`, `InboundFilters`, `LinkedErrors`, `Replay`, `ReportingObserver`, `RewriteFrames`, `TryCatch`.
- Integration options can be specified in the object value corresponding to the individual integration key.
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only) set the option to:
```js
{
ExtraErrorData: false,
}
```
- See also [Sentry Browser Integrations](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/) for more information on configuring each integration.
### serverIntegrations
- Type: `Object`
- Default:
```js
{
Dedupe: {},
ExtraErrorData: {},
RewriteFrames: { root: <rootDir> },
}
```
- Sentry by default enables the following server integrations: `Console`, `ContextLines`, `Context`, `FunctionToString`, `Http`, `InboundFilters`, `LinkedErrors`, `Modules`,`OnUncaughtException`, `OnUnhandledRejection`, `RequestData`.
- The full list of server integrations that are supported includes the ones above plus: `CaptureConsole`, `Debug`, `Dedupe`, `ExtraErrorData`, `Hapi`, `RewriteFrames`.
- Integration options can be specified in the object value corresponding to the individual integration key.
- To disable integration that is enabled by default, pass `false` as a value. For example to disable `ExtraErrorData` integration (only) set the option to:
```js
{
ExtraErrorData: false,
}
```
- See also [Sentry Server Integrations](https://docs.sentry.io/platforms/node/configuration/integrations/) for more information on configuring each integration.
### customClientIntegrations
- Type: `String`
- Default: `undefined`
- This option gives the flexibility to register any custom integration that is not handled internally by the `clientIntegrations` option.
- The value needs to be a file path (can include [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file that exports a function returning an array of initialized integrations. The function will be passed a `context` argument which is the Nuxt Context.
For example:
```js
import SentryRRWeb from '@sentry/rrweb'
export default function (context) {
return [new SentryRRWeb()]
}
```
### customServerIntegrations
- Type: `String`
- Default: `undefined`
- This option gives the flexibility to register any custom integration that is not handled internally by the `serverIntegrations` option.
- The value needs to be a file path (can include [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file that exports a function returning an array of initialized integrations.
For example:
```js
import MyAwesomeIntegration from 'my-awesome-integration'
export default function () {
return [new MyAwesomeIntegration()]
}
```
### tracing
- Type: `Boolean` or `Object`
- Default: `false`
- Enables Sentry Performance Monitoring on the [server](https://docs.sentry.io/platforms/node/guides/express/performance/) and [browser](https://docs.sentry.io/platforms/javascript/guides/vue/performance/) side.
- Takes the following object configuration format (default values shown):
```js
{
tracesSampleRate: 1.0,
browserTracing: {},
vueOptions: {
trackComponents: true,
},
vueRouterInstrumentationOptions: {
routeLabel: 'name',
},
}
```
- On the browser side the `BrowserTracing` integration is enabled by default and adds automatic instrumentation for monitoring the performance of the application. See all available [`BrowserTracing` options](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/).
- The [Vue Router Integration](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) is also automatically enabled on the browser side and defaults to using route names as labels. [Supported options](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/#configuration) can be passed through the `vueRouterInstrumentationOptions` object.
- On the browser side extra options for [Tracking Vue components](https://docs.sentry.io/platforms/javascript/guides/vue/features/component-tracking/) can be passed through the `vueOptions` object.
- On the server side the `Http` integration is enabled to trace HTTP requests and [tracingHandler](https://docs.sentry.io/platforms/node/guides/express/performance/) is enabled to trace `connect` and `express` routes.
- See also the [Performance Monitoring](/guide/performance) section for more information.
<alert type="info">
The `tracesSampleRate` value can be between 0.0 and 1.0 (percentage of requests to capture) and Sentry documentation strongly recommends reducing the value from the default 1.0.
</alert>
### config
- Type: `Object`
- Default:
```js
{
environment: this.options.dev ? 'development' : 'production'
}
```
- Additional options to pass to the Sentry SDK common to the Server and the Browser SDKs and which are passed to `Sentry.init()`. See Sentry's documentation for [Basic Browser Options](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/) and [Basic Server Options](https://docs.sentry.io/platforms/node/configuration/options/).
- If you need to pass options only to the client or the server SDK instance then use `clientConfig` and `serverConfig` respectively.
- Note that `config.dsn` is automatically set based on the root `dsn` option.
- The value for `config.release` is automatically inferred from the local repo unless specified manually.
- Do not set `config.integrations`, use `clientIntegrations` and `serverIntegrations` options instead.
### serverConfig
- Type: `Object` or `String`
- Default: `{}`
- Sentry SDK [Basic Server Options](https://docs.sentry.io/platforms/node/configuration/options/).
- The specified keys will override common options set in the `config` key.
- The value can be a string in which case it needs to be a file path (can use [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file whose default export (a function) returns the configuration object. This is necessary in case some of the options rely on imported values or can't be serialized. The function can be `async`. An artificial example that switches out the `transport`:
```js [nuxt.config.js]
sentry: {
dsn: '...',
serverConfig: '~/config/sentry-server-config.js',
}
```
```js [~/config/sentry-server-config.js]
import { makeNodeTransport } from '@sentry/node'
export default function() {
return {
transport: makeNodeTransport,
}
}
```
### clientConfig
- Type: `Object` or `String`
- Default: `{}`
- Sentry SDK [Basic Browser Options](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/options/).
- The specified keys will override common options set in the `config` key.
- The value can be a string in which case it needs to be a file path (can use [webpack aliases](https://nuxtjs.org/docs/2.x/directory-structure/assets#aliases)) pointing to a javascript file whose default export (a function) returns the configuration object. This is necessary in case some of the options rely on imported values or can't be serialized. The function is passed a `Nuxt Context` argument and can be `async`.
- See an example usage on the [User Feedback](/guide/user-feedback) page.
### requestHandlerConfig
- Type: `Object`
- Default: `{}`
- Options passed to `requestHandler` in `@sentry/node`. See: https://docs.sentry.io/platforms/node/guides/express/
================================================
FILE: docs/content/en/configuration/runtime-config.md
================================================
---
title: Runtime config
description: "Load Sentry configuration at runtime"
position: 16
category: Configuration
---
<alert type="info">
This module is for Nuxt 2. For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
</alert>
Defining options using the [Nuxt Runtime Config](https://nuxtjs.org/docs/2.x/configuration-glossary/configuration-runtime-config/) functionality allows them to be runtime-based rather than build-time based, as is the case by default.
Currently, only the `config`, `clientConfig` and `serverConfig` [options](/configuration/options) can be configured using the runtime config.
In the Nuxt configuration file define a `publicRuntimeConfig.sentry` configuration object with settings that will be applied at runtime. For example:
```js [nuxt.config.js]
publicRuntimeConfig: {
sentry: {
config: {
environment: process.env.SENTRY_ENVIRONMENT
},
serverConfig: {
// Any server-specific config
},
clientConfig: {
// Any client-specific config
}
}
}
```
You can customize the key that is used to access settings from `publicRuntimeConfig` by setting [`runtimeConfigKey`](/configuration/options#runtimeconfigkey) in the non-runtime options.
This functionality is supported from Nuxt 2.13 and up.
================================================
FILE: docs/content/en/getting-started/setup.md
================================================
---
title: Setup
description: 'Setup the sentry module into Nuxt'
position: 10
category: Getting Started
---
<alert type="info">
This module is for Nuxt 2. For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
</alert>
Check the [Nuxt.js documentation](https://nuxtjs.org/guides/configuration-glossary/configuration-modules) for more information about installing and using modules in Nuxt.js.
> Nuxt.js v2.16.0+ is required, earlier versions are not supported.
## Installation
Add `@nuxtjs/sentry` dependency to your project:
<code-group>
<code-block label="Yarn" active>
```bash
yarn add @nuxtjs/sentry
```
</code-block>
<code-block label="NPM">
```bash
npm install @nuxtjs/sentry
```
</code-block>
</code-group>
Then, add `@nuxtjs/sentry` to the `modules` section of `nuxt.config.js` and set your unique `dsn` value:
```js [nuxt.config.js]
{
modules: [
'@nuxtjs/sentry'
],
sentry: {
dsn: '', // Enter your project's DSN.
// Additional module options go here.
}
}
```
See [Options](/configuration/options) for a list of available options.
Note that the Sentry SDK dependencies (`@sentry/*`) are not pinned and can be updated independently from the module itself by running `npm upgrade @nuxtjs/sentry` or `yarn upgrade @nuxtjs/sentry`. That means you don't have to wait for a new module release if you want to update to the latest SDK version.
## Types
In Typescript or type-checked JavaScript projects, add `@nuxtjs/sentry` to the `types` array in `tsconfig.json` to enable module types.
```json [tsconfig.json]
{
"compilerOptions": {
// ...
"types": [
"@nuxtjs/sentry"
]
}
}
```
<alert type="info">
The otherwise optional package `@sentry/webpack-plugin@2` has to be installed for types to be fully working.
If not using the relevant functionality (`publishRelease` option is not enabled) then this package can be installed as dev-only dependency.
</alert>
================================================
FILE: docs/content/en/guide/enrich-events.md
================================================
---
title: Enriching Events
description: Enriching Reported Events
position: 21
category: Guide
---
Sentry SDK provides API for enhancing events that are being reported. For example, you can:
- set user information like IP address or username using `Sentry.setUser` API
- add custom structured data using `Sentry.setContext` API
- set custom key/value pairs (tags) that get indexed and can be used for filtering and searching using `Sentry.setTag` API
- add file attachments using `scope.addAttachment` API
- manually add breadcrumbs using `Sentry.addBreadcrumb` API
- and other...
Read more about [Enriching Events](https://docs.sentry.io/platforms/javascript/guides/vue/enriching-events/).
================================================
FILE: docs/content/en/guide/lazy-loading.md
================================================
---
title: Lazy-Loading
description: Load Sentry module lazily on the client
position: 22
category: Guide
---
Set `lazy: true` in your module options to load Sentry lazily on the client. This will prevent Sentry from being included in your main bundle and should result in a faster initial page load.
You can also pass a lazy config object in your module options (see [options](/configuration/options#lazy) for more information).
<alert type="info">
Please be aware that lazy loading could prevent some errors that happen early during app loading from being reported and, if `tracing` is enabled, some performance metrics might not be accurate.
</alert>
### Injected properties
#### `$sentry` (mocked)
- Type: `Object`
Normally `$sentry` would always refer to the `@sentry/vue` API. But if we lazy load Sentry this API wont be available until Sentry has loaded. If you don't want to worry about whether Sentry is loaded or not, a mocked Sentry API is injected into the Nuxt.js context that will execute all Sentry API calls once Sentry is loaded
See: [`injectMock`](/configuration/options#lazy) and [`mockApiMethods`](/configuration/options#lazy) options.
#### `$sentryReady`
- Type `Function`
This method returns a Promise which will be resolved once Sentry has been loaded. You could use this instead of mocking `$sentry`.
Example usage:
```js
this.$sentryReady().then((sentry) => sentry.captureMessage('Erreur!'))
// or
(await this.$sentryReady()).captureMessage('Erreur!')
```
#### `$sentryLoad`
- Type: `Function`
> Only injected when `injectLoadHook: true`.
The callback you need to call to indicate that you are ready to load Sentry.
Example usage:
```js [layouts/default.vue]
mounted() {
// This will only load sentry once an error was thrown
// To prevent a chicken & egg issue, make sure to also
// set injectMock: true if you use this so the error
// that triggered the load will also be captured
this.errorListener = () => {
this.$sentryLoad()
window.removeEventListener('error', this.errorListener)
}
window.addEventListener('error', this.errorListener)
},
destroyed() {
window.removeEventListener('error', this.errorListener)
}
```
================================================
FILE: docs/content/en/guide/migration.md
================================================
---
title: Migration guide
description: Follow this guide to upgrade from one major version to the other.
position: 29
category: Guide
---
Follow this guide to upgrade from one major version to the other.
## Upgrading from v7 to v8
Breaking changes only affect the `publishRelease` and the (related to `publishRelease`) `sourceMapStyle` option.
When using the `publishRelease` option, the `@sentry/webpack-plugin` package needs to be updated from version 1.x to 2.x.
The options supported by the `publishRelease` object have also changed slightly:
- `configFile`, `dryRun`, `include`, `sourcemap` and `urlPrefix` options are no longer supported.
- `setCommits` option moved to `release.setCommits`
- `errorHandler` option signature has changed - see https://sentry.nuxtjs.org/guide/releases
The default value of the `sourceMapStyle` option has changed from `source-map` to `hidden-source-map` since the new version of the webpack plugin can handle source maps without having to reference them directly in the source files.
You can also check the [`@sentry/webpack-plugin` official migration guide](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/main/MIGRATION.md#upgrading-to-2x) for more information although not everything mentioned there applies to this module.
## Upgrading from v6 to v7
Sentry SDK dependencies updated from v6 to v7. Please read about breaking changes in Sentry SDK's [Upgrading from v6.x to v7.x](https://github.com/getsentry/sentry-javascript/blob/master/MIGRATION.md#upgrading-from-6x-to-7x) document.
Some of the breaking changes listed in that document are automatically handled by the module and don't need any action. Other notable changes that might require action are:
- The `@sentry/tracing` dependency should be uninstalled, regardless whether `tracing` option is used or not.
- The `whitelistUrls` and `blacklistUrls` Sentry `config` (or `clientConfig` / `serverConfig`) options have been renamed to `allowUrls` and `denyUrls`.
- The `Vue` integration was removed as is now merged into the Sentry Browser SDK. If you have been passing custom `Vue` options through the `clientIntegrations.Vue` object then those can now be merged directly into the `clientConfig` option (without the parent `Vue` key).
- The `UserAgent` integration was renamed to `HttpContext`. If you have been passing custom configuration to that integration through `clientIntegrations` option then you should rename the key.
================================================
FILE: docs/content/en/guide/performance.md
================================================
---
title: Performance Monitoring
description: Track performance metrics
position: 23
category: Guide
---
To automatically configure and enable performance monitoring, enable the [tracing](/configuration/options#tracing) option.
This enables various additional integrations for monitoring and instrumentation. On the client-side it enables [`BrowserTracing`](https://docs.sentry.io/platforms/javascript/guides/vue/performance/instrumentation/automatic-instrumentation/) and [`Vue Router Instrumentation`](https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/vue-router/) integrations. On the server-side it enables the [`Http` and `tracingHandler`](https://docs.sentry.io/platforms/node/guides/express/performance/instrumentation/automatic-instrumentation/) integrations for tracing HTTP requests and `connect`/`express` routes.
See the description of the [tracing](/configuration/options#tracing) option if you want to customize some aspect of that functionality like the percentage of requests to capture.
<alert type="info">
Note that the `tracesSampleRate` value can be between 0.0 and 1.0 (percentage of requests to capture) and Sentry documentation strongly recommends reducing the value from the default 1.0.
</alert>
See also Sentry's SDK [client](https://docs.sentry.io/platforms/javascript/guides/vue/performance/) and [server](https://docs.sentry.io/platforms/node/guides/express/performance/) Performance Monitoring pages for additional information about those integrations.
================================================
FILE: docs/content/en/guide/profiling.md
================================================
---
title: Profiling
description: Node profiling enhances tracing by providing profiles for individual transactions
position: 25
category: Guide
---
Node profiling can be enabled through an integration provided by the `@sentry/profiling-node` dependency that does not come with this module by default.
### Setup
Install required dependency:
<code-group>
<code-block label="Yarn" active>
```bash
yarn add @sentry/profiling-node
```
</code-block>
<code-block label="NPM">
```bash
npm install @sentry/profiling-node
```
</code-block>
</code-group>
Include the following options in the module's configuration:
```js [nuxt.config.js]
sentry: {
dsn: '...',
tracing: {
tracesSampleRate: 1.0,
},
serverIntegrations: {
ProfilingIntegration: {},
},
serverConfig: {
// Set sampling rate for profiling - this is relative to tracesSampleRate
profilesSampleRate: 1.0,
},
}
```
<alert type="info">
Note that the `tracesSampleRate` value can be between 0.0 and 1.0 (percentage of requests to capture) and Sentry documentation strongly recommends reducing the value from the default 1.0.
</alert>
### Documentation
See Sentry's [Profiling](https://docs.sentry.io/platforms/node/profiling/) pages for additional information.
================================================
FILE: docs/content/en/guide/releases.md
================================================
---
title: Releases
description: Creating and publishing Releases
position: 24
category: Guide
---
> Notifying Sentry of a release enables auto discovery of which commits to associate with a release and identifies what we consider "the most recent release" when searching in sentry.io.
>
> See Sentry's [Releases](https://docs.sentry.io/product/releases/) for additional information.
## Setup
Follow the following steps to create and publish releases to Sentry.
1. Install the `@sentry/webpack-plugin@2` package as a dev dependency.
2. Enable the [publishRelease](/configuration/options#publishrelease) option. Follow the link for mode detailed explanation of available options.
<alert type="info">
Releases will only be published during `nuxt build`.
</alert>
## Error handling
On error during publishing, the build will be interrupted. If you would instead want to ignore errors during publishing, you can modify the behavior by customizing the `publishRelease.errorHandler` option. For example, the following configuration will post a warning to the console instead of interrupting the build:
```js
{
sentry: {
publishRelease: {
// other options...
errorHandler(error) {
console.error(`Sentry Release Error: ${error.message}`);
},
},
}
}
```
================================================
FILE: docs/content/en/guide/session-replay.md
================================================
---
title: Session Replay
description: Record and replay user interactions that lead to an error
position: 24
category: Guide
---
Session Replay helps you get to the root cause of an error or latency issue faster by providing you with a video-like reproduction of what was happening in the user's browser before, during, and after the issue.
### Setup
Session Replay comes as a separate integration that is not enabled by default. To enable it, add `Replay: {}` to the [`clientIntegrations`](/configuration/options#clientintegrations) option like so:
```js [nuxt.config.js]
sentry: {
dsn: '...',
clientIntegrations: {
Replay: {},
},
clientConfig: {
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
}
}
```
You can customize integration options by passing them within the `{}` object.
<alert type="info">
Note that the `replaysSessionSampleRate` and `replaysOnErrorSampleRate` options are part of the global client options and not options of the `Replay` integration itself.
</alert>
<alert type="info">
Refer to the Sentry documentation below to make sure that Content Security Policy (CSP) is configured properly for allowing `Replay` integration to do its work.
</alert>
### Documentation
See Sentry's [Session Replay](https://docs.sentry.io/platforms/javascript/guides/vue/session-replay/) pages for additional information.
================================================
FILE: docs/content/en/guide/usage.md
================================================
---
title: Usage / API
description: Usage of Sentry in Nuxt
position: 20
category: Guide
---
### Automatic Capturing
Once enabled, Sentry automatically reports errors, uncaught exceptions and unhandled rejections. No need for further steps, unless you like to report (certain) exceptions manually or have deactivated integrations like `GlobalError`. In this case, find out below how to send reports manually.
### Usage in Vue components
In a Vue component, `Sentry` is available as `this.$sentry`, so we can call functions like
```js
this.$sentry.captureException(new Error('example'))
```
where `this` is a Vue instance.
### Usage in `asyncData`
While using Nuxt's `asyncData` method, there's `$sentry` object in the `context` object:
```js
async asyncData ({ params, $sentry }) {
try {
let { data } = await axios.get(`https://my-api/posts/${params.id}`)
return { title: data.title }
} catch (error) {
$sentry.captureException(error)
}
}
```
### Usage in server middleware
Server Sentry instance is accessible through `process.sentry`.
### Usage in other lifecycle areas
For the other special Nuxt lifecycle areas like `plugins`, `middleware`, and `nuxtServerInit`, the `$sentry` object is also accessible through the `context` object like so:
```js
async nuxtServerInit({ commit }, { $sentry }) {
try {
let { data } = await axios.get(`https://my-api/timestamp`)
commit('setTimeStamp', data)
} catch (error) {
$sentry.captureException(error)
}
}
```
================================================
FILE: docs/content/en/guide/user-feedback.md
================================================
---
title: User Feedback
description: A feedback dialog for providing additional user information
position: 25
category: Guide
---
When a user experiences an error, Sentry provides the ability to collect additional feedback through a feedback dialog.
### Setup
`showReportDialog` is a function that should be called to trigger the User Feedback dialog. Due to how Nuxt works, we can't reference it directly from within Nuxt config as Sentry configuration is strinigified and the function reference does not survive that. We have to use the `clientConfig` option with a path to a custom client configuration that imports the function like so:
```js [nuxt.config.js]
sentry: {
dsn: '...',
clientConfig: '~/config/sentry-client-config.js',
}
```
```js [~/config/sentry-client-config.js]
import { showReportDialog } from '@sentry/vue'
export default function(context) {
return {
beforeSend (event, hint) {
if (event.exception) {
showReportDialog({ eventId: event.event_id })
}
return event
},
}
}
```
<alert type="info">
The configuration provided through `clientConfig` is merged with the configuration provided in the Nuxt config so other configuration options can (but don't have to) be defined in Nuxt config.
</alert>
### Documentation
See Sentry's [User Feedback](https://docs.sentry.io/platforms/javascript/guides/vue/enriching-events/user-feedback/) pages for additional information.
================================================
FILE: docs/content/en/index.md
================================================
---
title: Introduction
description: 'Sentry Module for Nuxt'
position: 1
category: ''
---
<alert type="info">
This module is for Nuxt 2. For [Nuxt 3+](https://nuxt.com/) support see the official [`@sentry/nuxt` module](https://docs.sentry.io/platforms/javascript/guides/nuxt/).
</alert>
<img src="/preview.png" class="light-img" width="1280" height="640" alt=""/>
<img src="/preview-dark.png" class="dark-img" width="1280" height="640" alt=""/>
[Sentry Module](https://github.com/nuxt-community/sentry-module) for [Nuxt 2](https://v2.nuxt.com/).
## Features
The module enables error logging through [Sentry](https://sentry.io/).
## More Resources
* [GitHub](https://github.com/nuxt-community/sentry-module)
* [Releases](https://github.com/nuxt-community/sentry-module/releases)
* [MIT Licence](https://github.com/nuxt-community/sentry-module/blob/master/LICENSE)
================================================
FILE: docs/content/settings.json
================================================
{
"title": "Sentry module",
"url": "https://sentry.nuxtjs.org",
"logo": {
"light": "/logo-light.svg",
"dark": "/logo-dark.svg"
},
"github": "nuxt-community/sentry-module",
"twitter": "@nuxt_js"
}
================================================
FILE: docs/nuxt.config.js
================================================
import theme from '@nuxt/content-theme-docs'
export default theme({
docs: {
primaryColor: '#ae9dff',
},
modules: [
'@nuxtjs/redirect-module',
],
redirect: {
onDecodeError: (_error, _req, _res, next) => next(),
rules: [
{
from: '^/guide/setup',
to: '/getting-started/setup',
statusCode: 301,
},
{
from: '^/sentry/lazy-loading',
to: '/getting-started/lazy-loading',
statusCode: 301,
},
{
from: '^/sentry/options',
to: '/configuration/options',
statusCode: 301,
},
{
from: '^/sentry/runtime-config',
to: '/configuration/runtime-config',
statusCode: 301,
},
],
},
})
================================================
FILE: docs/package.json
================================================
{
"name": "docs",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"postinstall": "patch-package"
},
"dependencies": {
"@nuxt/content-theme-docs": "0.11.1",
"@nuxt/types": "^2.18.1",
"@nuxtjs/redirect-module": "^0.3.1",
"nuxt": "2.18.1",
"patch-package": "^8.0.0"
}
}
================================================
FILE: docs/patches/@nuxtjs+tailwindcss+3.4.3.patch
================================================
diff --git a/node_modules/@nuxtjs/tailwindcss/lib/module.js b/node_modules/@nuxtjs/tailwindcss/lib/module.js
index c935c0b..0352b28 100644
--- a/node_modules/@nuxtjs/tailwindcss/lib/module.js
+++ b/node_modules/@nuxtjs/tailwindcss/lib/module.js
@@ -56,17 +56,19 @@ module.exports = async function (moduleOptions) {
*/
const { postcss } = nuxt.options.build
- postcss.preset.stage = 1 // see https://tailwindcss.com/docs/using-with-preprocessors#future-css-features
- postcss.plugins = postcss.plugins || {}
+ postcss.postcssOptions = postcss.postcssOptions || {}
+ postcss.postcssOptions.preset = postcss.postcssOptions.preset || {}
+ postcss.postcssOptions.preset.stage = 1 // see https://tailwindcss.com/docs/using-with-preprocessors#future-css-features
+ postcss.postcssOptions.plugins = postcss.postcssOptions.plugins || {}
// Let modules extend the tailwind config
await nuxt.callHook('tailwindcss:config', tailwindConfig)
/* istanbul ignore if */
- if (Array.isArray(postcss.plugins)) {
+ if (Array.isArray(postcss.postcssOptions.plugins)) {
logger.error('Array syntax for postcss plugins is not supported with v3. Please use the object syntax: https://nuxtjs.org/guides/configuration-glossary/configuration-build#postcss')
- } else if (typeof postcss.plugins === 'object') {
- postcss.plugins.tailwindcss = tailwindConfig
+ } else if (typeof postcss.postcssOptions.plugins === 'object') {
+ postcss.postcssOptions.plugins.tailwindcss = tailwindConfig
}
/*
================================================
FILE: eslint.config.mjs
================================================
import base from 'eslint-config-rchl-base'
import typescript from 'eslint-config-rchl-typescript'
import vue from 'eslint-config-rchl-vue'
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: [
'**/.nuxt/',
'**/dist/',
'**/templates/',
'node_modules/',
],
},
...base,
...typescript,
...vue,
{
rules: {
'@stylistic/indent': [
'error', 2, {
SwitchCase: 1,
},
],
'@stylistic/semi': ['error', 'never'],
'@stylistic/space-before-function-paren': ['error', 'always'],
},
},
{
files: ['**/*.ts', '**/*.tsx'],
rules: {
'@stylistic/ts/indent': [
'error', 2, {
SwitchCase: 1,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
CallExpression: { arguments: 'first' },
},
],
'@stylistic/ts/member-delimiter-style': [
'error', {
multiline: {
delimiter: 'none',
},
},
],
'@stylistic/ts/semi': ['error', 'never'],
'@stylistic/ts/space-before-function-paren': ['error', 'always'],
},
},
{
files: ['**/*.vue'],
rules: {
'vue/html-indent': ['error', 2],
'vue/script-indent': ['error', 2, { switchCase: 1 }],
},
},
{
files: ['**/.nuxt/*.js'],
rules: {
'@stylistic/comma-spacing': 'off',
'@stylistic/key-spacing': 'off',
'@stylistic/object-curly-spacing': 'off',
'@stylistic/quote-props': 'off',
'@stylistic/quotes': 'off',
},
},
]
================================================
FILE: netlify.toml
================================================
# https://docs.netlify.com/configure-builds/file-based-configuration
[build]
base = "docs"
command = "yarn generate"
publish = "dist"
================================================
FILE: package.json
================================================
{
"name": "@nuxtjs/sentry",
"version": "8.0.8",
"description": "Sentry module for Nuxt.js",
"repository": "nuxt-community/sentry-module",
"license": "MIT",
"contributors": [
{
"name": "Diederik van den Burger <diederik@webrelated.nl>"
},
{
"name": "Rafal Chlodnicki (@rchl)"
}
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
},
"type": "module",
"exports": {
".": {
"import": "./dist/module.mjs",
"require": "./dist/module.cjs",
"types": "./dist/module.d.ts"
}
},
"main": "./dist/module.cjs",
"types": "./dist/module.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "yarn prepack",
"prepack": "nuxt-module-build build",
"dev:prepare": "nuxt-module-build build --stub",
"dev:fixture": "node ./node_modules/nuxt/bin/nuxt.js -c ./test/fixture/default/nuxt.config",
"dev:fixture:build": "node ./node_modules/nuxt/bin/nuxt.js build -c ./test/fixture/default/nuxt.config",
"dev:fixture:start": "node ./node_modules/nuxt/bin/nuxt.js start -c ./test/fixture/default/nuxt.config",
"dev:generate": "nuxt generate -c ./test/fixture/default/nuxt.config --force-build",
"analyze": "node ./node_modules/nuxt/bin/nuxt.js build --analyze -c ./test/fixture/default/nuxt.config",
"size": "yarn build && cd size-check && yarn build && cd .. && yarn size-limit",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:fixture": "eslint --no-ignore 'test/fixture/*/.nuxt/sentry.*'",
"release": "release-it",
"test": "yarn prepack && vitest run --poolOptions.threads.singleThread && yarn lint:fixture && yarn typecheck",
"test:watch": "vitest",
"typecheck": "yarn dev:prepare && tsc && tsc -p ./test/tsconfig.json"
},
"lint-staged": {
"*.{js,ts,vue}": [
"eslint"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm run typecheck",
"post-merge": "yarn"
}
},
"dependencies": {
"@sentry/core": "^7.119.0",
"@sentry/integrations": "^7.114.0",
"@sentry/node": "^7.119.0",
"@sentry/utils": "^7.119.0",
"@sentry/vue": "^7.119.0",
"consola": "^3.2.3",
"defu": "^6.1.4",
"hash-sum": "^2.0.0",
"jiti": "^1.21.0",
"lodash.mergewith": "^4.6.2",
"mlly": "^1.5.0",
"pathe": "^1.1.2"
},
"devDependencies": {
"@nuxt/module-builder": "0.8.3",
"@nuxt/types": "2.18.1",
"@nuxt/typescript-build": "^3.0.2",
"@nuxtjs/module-test-utils": "1.6.3",
"@release-it/conventional-changelog": "8.0.1",
"@sentry/profiling-node": "7.119.0",
"@sentry/webpack-plugin": "2.22.3",
"@size-limit/file": "11.1.4",
"@types/hash-sum": "1.0.2",
"@types/lodash.mergewith": "4.6.9",
"@types/node": "20.16.3",
"@types/request-promise-native": "1.0.21",
"eslint": "^9.12.0",
"eslint-config-rchl-base": "^2.0.3",
"eslint-config-rchl-typescript": "^3.0.2",
"eslint-config-rchl-vue": "^3.0.0",
"hookable": "5.5.3",
"husky": "4.3.8",
"lint-staged": "15.2.10",
"npm-run-all2": "6.2.2",
"nuxt": "2.18.1",
"playwright-chromium": "1.46.1",
"release-it": "17.6.0",
"sass": "1.77.8",
"sentry-testkit": "5.0.9",
"size-limit": "11.1.4",
"typescript": "5.5.4",
"vitest": "2.1.2",
"vue": "2.7.16",
"vuex": "3.6.2"
},
"resolutions": {
"watchpack": "^2.0.0"
}
}
================================================
FILE: renovate.json
================================================
{
"extends": [
"config:base",
":prHourlyLimit4",
":semanticCommitTypeAll(chore)"
],
"meteor": {
"enabled": false
},
"lockFileMaintenance": {
"enabled": true,
"branchTopic": "lock-file-maintenance-{{packageFile}}",
"commitMessageExtra": "({{packageFile}})"
},
"postUpdateOptions": [
"yarnDedupeFewer"
],
"rangeStrategy": "auto",
"npm": {
"commitMessageTopic": "{{prettyDepType}} {{depName}}"
},
"packageRules": [
{
"matchPackageNames": [
"node"
],
"enabled": false
},
{
"groupName": "Sentry SDK",
"matchPackagePatterns": ["^@sentry"],
"matchFiles": ["package.json"],
"rangeStrategy": "bump",
"semanticCommitType": "fix"
},
{
"groupName": "size-limit",
"matchPackagePatterns": ["^@?size-limit"],
"matchFiles": ["package.json"],
"matchUpdateTypes": [
"major"
]
},
{
"excludePackagePatterns": ["^@sentry"],
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch",
"matchFiles": ["package.json"],
"matchUpdateTypes": [
"minor",
"patch"
]
},
{
"groupName": "Docs dependencies",
"matchFiles": ["docs/package.json"],
"matchUpdateTypes": [
"minor",
"patch"
]
}
]
}
================================================
FILE: size-check/base/nuxt.config.cjs
================================================
const SentryModule = require('../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
},
}
module.exports = config
================================================
FILE: size-check/base/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: size-check/lazy/nuxt.config.cjs
================================================
const SentryModule = require('../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
lazy: true,
},
}
module.exports = config
================================================
FILE: size-check/lazy/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: size-check/lazy+tracing/nuxt.config.cjs
================================================
const SentryModule = require('../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
lazy: true,
tracing: true,
},
}
module.exports = config
================================================
FILE: size-check/lazy+tracing/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: size-check/package.json
================================================
{
"private": true,
"scripts": {
"build": "npm-run-all --parallel build:*",
"build:base": "nuxt build -c ./base/nuxt.config",
"build:replay": "nuxt build -c ./replay/nuxt.config",
"build:tracing": "nuxt build -c ./tracing/nuxt.config",
"build:lazy": "nuxt build -c ./lazy/nuxt.config",
"build:lazy+tracing": "nuxt build -c ./lazy+tracing/nuxt.config",
"build:typescript": "nuxt build -c ./typescript/nuxt.config"
}
}
================================================
FILE: size-check/replay/nuxt.config.cjs
================================================
const SentryModule = require('../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
Replay: {},
},
},
}
module.exports = config
================================================
FILE: size-check/replay/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: size-check/tracing/nuxt.config.cjs
================================================
const SentryModule = require('../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
tracing: true,
},
}
module.exports = config
================================================
FILE: size-check/tracing/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: size-check/typescript/config/server.config.ts
================================================
import type { ModuleOptions } from '../../../src/types'
export default function (): ModuleOptions['serverConfig'] {
return {
beforeSend (event, _hint) {
event.extra = {
foo: '1',
}
return event
},
}
}
================================================
FILE: size-check/typescript/nuxt.config.ts
================================================
import { fileURLToPath } from 'node:url'
import initJiti from 'jiti'
import type { NuxtConfig } from '@nuxt/types'
const jiti = initJiti(fileURLToPath(import.meta.url))
const config: NuxtConfig = {
rootDir: __dirname,
telemetry: false,
buildModules: [
'@nuxt/typescript-build',
],
modules: [
jiti.resolve('../..'),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
},
typescript: {
typeCheck: false,
},
}
export default config
================================================
FILE: size-check/typescript/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
asyncData ({ $sentry, query }) {
if (query.crashOnLoad) {
// @ts-ignore forces a crash
crashOnLoad()
}
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
})
</script>
================================================
FILE: size-check/typescript/tsconfig.json
================================================
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": [
"@nuxt/typescript-build",
]
},
}
================================================
FILE: src/hooks.ts
================================================
import { fileURLToPath } from 'url'
import { resolve } from 'path'
import { defu } from 'defu'
import type { ConsolaInstance } from 'consola'
import type { Configuration as WebpackConfig } from 'webpack'
import type { SentryWebpackPluginOptions } from '@sentry/webpack-plugin'
import type { Options } from '@sentry/types'
import * as Sentry from '@sentry/node'
import { addPluginTemplate, addTemplate, addWebpackPlugin } from './kit-shim'
import type { Nuxt } from './kit-shim'
import type { ModuleConfiguration } from './types/configuration'
import { clientSentryEnabled, serverSentryEnabled, canInitialize } from './utils'
import { resolveRelease, ResolvedClientOptions, resolveClientOptions, ResolvedServerOptions, resolveServerOptions } from './options'
import type { SentryHandlerProxy } from './options'
const RESOLVED_RELEASE_FILENAME = 'sentry.release.config.mjs'
export async function buildHook (nuxt: Nuxt, moduleOptions: ModuleConfiguration, logger: ConsolaInstance): Promise<void> {
const release = await resolveRelease(moduleOptions)
const templateDir = fileURLToPath(new URL('./templates', import.meta.url))
const pluginOptionClient = clientSentryEnabled(moduleOptions) && canInitialize(moduleOptions) ? moduleOptions.lazy ? 'lazy' : 'client' : 'mocked'
const clientOptions: ResolvedClientOptions = defu({ config: { release } }, await resolveClientOptions(nuxt, moduleOptions, logger))
addPluginTemplate({
src: resolve(templateDir, `plugin.${pluginOptionClient}.js`),
filename: 'sentry.client.js',
mode: 'client',
options: clientOptions,
})
if (pluginOptionClient !== 'mocked') {
addTemplate({
src: resolve(templateDir, 'client.shared.js'),
filename: 'sentry.client.shared.js',
options: clientOptions,
})
}
const pluginOptionServer = serverSentryEnabled(moduleOptions) ? 'server' : 'mocked'
const serverOptions: ResolvedServerOptions = defu({ config: { release } }, await resolveServerOptions(nuxt, moduleOptions, logger))
addPluginTemplate({
src: resolve(templateDir, `plugin.${pluginOptionServer}.js`),
filename: 'sentry.server.js',
mode: 'server',
options: serverOptions,
})
if (serverSentryEnabled(moduleOptions)) {
addTemplate({
src: resolve(templateDir, 'options.ejs'),
filename: RESOLVED_RELEASE_FILENAME,
options: { release },
})
}
// Tree shake debugging code if not running in dev mode and Sentry debug option is not enabled on the client.
if (!clientOptions.dev && !clientOptions.config.debug) {
const webpack = await import('webpack').then(m => m.default || m)
addWebpackPlugin(new webpack.DefinePlugin({
__SENTRY_DEBUG__: 'false',
}))
}
}
export async function webpackConfigHook (nuxt: Nuxt, webpackConfigs: WebpackConfig[], options: ModuleConfiguration, logger: ConsolaInstance): Promise<void> {
let WebpackPlugin: typeof import('@sentry/webpack-plugin')
try {
WebpackPlugin = await import('@sentry/webpack-plugin').then(m => m.default || m)
} catch {
throw new Error('The "@sentry/webpack-plugin" package must be installed as a dev dependency to use the "publishRelease" option.')
}
const publishRelease: SentryWebpackPluginOptions = defu(options.publishRelease)
if (!publishRelease.sourcemaps) {
publishRelease.sourcemaps = {}
}
if (!publishRelease.sourcemaps.ignore) {
publishRelease.sourcemaps.ignore = []
}
if (!Array.isArray(publishRelease.sourcemaps.ignore)) {
publishRelease.sourcemaps.ignore = [publishRelease.sourcemaps.ignore]
}
if (!publishRelease.release) {
publishRelease.release = {}
}
publishRelease.release.name = publishRelease.release.name || options.config.release || await resolveRelease(options)
if (!publishRelease.release.name) {
// We've already tried to determine "release" manually using Sentry CLI so to avoid webpack plugin crashing, we'll just bail here.
logger.warn('Sentry release will not be published because "config.release" or "publishRelease.release.name" was not set nor it ' +
'was possible to determine it automatically from the repository.')
return
}
for (const config of webpackConfigs) {
config.devtool = options.sourceMapStyle
config.plugins = config.plugins || []
config.plugins.push(WebpackPlugin.sentryWebpackPlugin(publishRelease))
}
}
export async function initializeServerSentry (nuxt: Nuxt, moduleOptions: ModuleConfiguration, sentryHandlerProxy: SentryHandlerProxy, logger: ConsolaInstance): Promise<void> {
if (process.sentry) {
return
}
let release: string | undefined
try {
const path = resolve(nuxt.options.buildDir, RESOLVED_RELEASE_FILENAME)
release = (await import(path)).release
} catch {
// Ignored
}
const serverOptions = await resolveServerOptions(nuxt, moduleOptions, logger)
const config: Options = defu({ release }, serverOptions.config)
process.sentry = Sentry
if (canInitialize(moduleOptions)) {
Sentry.init(config)
sentryHandlerProxy.errorHandler = Sentry.Handlers.errorHandler()
sentryHandlerProxy.requestHandler = Sentry.Handlers.requestHandler(moduleOptions.requestHandlerConfig)
if (serverOptions.tracing) {
sentryHandlerProxy.tracingHandler = Sentry.Handlers.tracingHandler()
}
}
}
export async function shutdownServerSentry (): Promise<void> {
if (process.sentry) {
await process.sentry.close()
// @ts-expect-error not mutable in types
process.sentry = undefined
}
}
================================================
FILE: src/kit-shim.ts
================================================
// Shim created based on v3.2.3 of @nuxt/kit
import { existsSync } from 'node:fs'
import { consola } from 'consola'
import { defu } from 'defu'
import hash from 'hash-sum'
import { basename, parse, normalize, resolve } from 'pathe'
import { resolveAlias as _resolveAlias } from 'pathe/utils'
import type { Hookable } from 'hookable'
import type { WebpackPluginInstance, Configuration as WebpackConfig } from 'webpack'
import type { NuxtOptions } from '@nuxt/types'
type NuxtHooks = Record<string, any>
export interface Nuxt {
/** The resolved Nuxt configuration. */
options: NuxtOptions
hooks: Hookable<NuxtHooks>
hook: Nuxt['hooks']['hook']
callHook: Nuxt['hooks']['callHook']
addHooks: Nuxt['hooks']['addHooks']
ready: () => Promise<void>
close: () => Promise<void>
/** The production or development server. */
server?: any
vfs: Record<string, string>
}
interface ModuleMeta {
/** Module name. */
name?: string
/** Module version. */
version?: string
/**
* The configuration key used within `nuxt.config` for this module's options.
* For example, `@nuxtjs/axios` uses `axios`.
*/
configKey?: string
}
/** The options received. */
type ModuleOptions = Record<string, any>
type Awaitable<T> = T | Promise<T>
/** Input module passed to defineNuxtModule. */
interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
meta?: ModuleMeta
defaults?: T | ((nuxt: Nuxt) => T)
schema?: T
hooks?: Partial<NuxtHooks>
setup?: (this: void, resolvedOptions: T, nuxt: Nuxt) => Awaitable<void>
}
export interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
(this: void, inlineOptions: T, nuxt: Nuxt): void
getOptions?: (inlineOptions?: T, nuxt?: Nuxt) => Promise<T>
getMeta?: () => Promise<ModuleMeta>
}
/** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
export const nuxtCtx: { value: Nuxt | null } = {
value: null,
}
// TODO: Use use/tryUse from unctx. https://github.com/unjs/unctx/issues/6
/**
* Get access to Nuxt instance.
*
* Throws an error if Nuxt instance is unavailable.
*
* @example
* ```js
* const nuxt = useNuxt()
* ```
*/
export function useNuxt (): Nuxt {
const instance = nuxtCtx.value
if (!instance) {
throw new Error('Nuxt instance is unavailable!')
}
return instance
}
/**
* Get access to Nuxt instance.
*
* Returns null if Nuxt instance is unavailable.
*
* @example
* ```js
* const nuxt = tryUseNuxt()
* if (nuxt) {
* // Do something
* }
* ```
*/
export function tryUseNuxt (): Nuxt | null {
return nuxtCtx.value
}
// -- Nuxt 2 compatibility shims --
const NUXT2_SHIMS_KEY = '__nuxt2_shims_sentry_key__'
function nuxt2Shims (nuxt: Nuxt): void {
// Avoid duplicate install and only apply to Nuxt2
// @ts-expect-error nuxt2
if (!isNuxt2(nuxt) || nuxt[NUXT2_SHIMS_KEY]) {
return
}
// @ts-expect-error nuxt2
nuxt[NUXT2_SHIMS_KEY] = true
// Allow using nuxt.hooks
// @ts-expect-error Nuxt 2 extends hookable
nuxt.hooks = nuxt
// Allow using useNuxt()
if (!nuxtCtx.value) {
nuxtCtx.value = nuxt
nuxt.hook('close', () => {
nuxtCtx.value = null
})
}
}
export function defineNuxtModule<OptionsT extends ModuleOptions> (definition: ModuleDefinition<OptionsT>): NuxtModule<OptionsT> {
// Normalize definition and meta
if (!definition.meta) {
definition.meta = {}
}
if (definition.meta.configKey === undefined) {
definition.meta.configKey = definition.meta.name
}
// Resolves module options from inline options, [configKey] in nuxt.config, defaults and schema
function getOptions (inlineOptions?: OptionsT): Promise<OptionsT> {
const nuxt = useNuxt()
const configKey = definition.meta!.configKey || definition.meta!.name!
const _defaults = definition.defaults instanceof Function ? definition.defaults(nuxt) : definition.defaults
const _options = defu(inlineOptions, nuxt.options[configKey as keyof NuxtOptions], _defaults) as OptionsT
return Promise.resolve(_options)
}
// Module format is always a simple function
async function normalizedModule (this: any, inlineOptions: OptionsT): Promise<any> {
const nuxt = this.nuxt
// Avoid duplicate installs
const uniqueKey = definition.meta!.name || definition.meta!.configKey
if (uniqueKey) {
nuxt.options._requiredModules = nuxt.options._requiredModules || {}
if (nuxt.options._requiredModules[uniqueKey]) {
return false
}
nuxt.options._requiredModules[uniqueKey] = true
}
// Nuxt 3 shims
nuxt2Shims(nuxt)
// Resolve module and options
const _options = await getOptions(inlineOptions)
const res = await definition.setup?.call(null as any, _options, nuxt) ?? {}
// Return module install result
return defu(res, {})
}
// Define getters for options and meta
normalizedModule.getMeta = () => Promise.resolve(definition.meta)
normalizedModule.getOptions = getOptions
return normalizedModule as NuxtModule<OptionsT>
}
export const logger = consola
export function useLogger (tag?: string): typeof consola {
return tag ? logger.withTag(tag) : logger
}
export function isNuxt2 (): boolean {
return true
}
interface NuxtTemplate<Options = Record<string, any>> {
/** resolved output file path (generated) */
dst?: string
/** The target filename once the template is copied into the Nuxt buildDir */
filename?: string
/** An options object that will be accessible within the template via `<% options %>` */
options?: Options
/** The resolved path to the source file to be template */
src?: string
/** Provided compile option instead of src */
getContents?: (data: Options) => string | Promise<string>
/** Write to filesystem */
write?: boolean
}
interface ResolvedNuxtTemplate<Options = Record<string, any>> extends NuxtTemplate<Options> {
filename: string
dst: string
}
interface NuxtPlugin {
/** @deprecated use mode */
ssr?: boolean
src: string
mode?: 'all' | 'server' | 'client'
}
type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options>
interface NuxtPluginTemplate<Options = Record<string, any>> extends _TemplatePlugin<Options> {}
/**
* Resolve path aliases respecting Nuxt alias options
*/
export function resolveAlias (path: string, alias?: Record<string, string>): string {
if (!alias) {
alias = tryUseNuxt()?.options.alias || {}
}
return _resolveAlias(path, alias)
}
/**
* Normalize a nuxt plugin object
*/
export function normalizePlugin (plugin: NuxtPlugin | string): NuxtPlugin {
// Normalize src
if (typeof plugin === 'string') {
plugin = { src: plugin }
} else {
plugin = { ...plugin }
}
if (!plugin.src) {
throw new Error('Invalid plugin. src option is required: ' + JSON.stringify(plugin))
}
// TODO: only scan top-level files #18418
const nonTopLevelPlugin = plugin.src.match(/\/plugins\/[^/]+\/index\.[^/]+$/i)
if (nonTopLevelPlugin && nonTopLevelPlugin.length > 0 && !useNuxt().options.plugins.find(i => (typeof i === 'string' ? i : i.src).endsWith(nonTopLevelPlugin[0]))) {
console.warn(`[warn] [nuxt] [deprecation] You are using a plugin that is within a subfolder of your plugins directory without adding it to your config explicitly. You can move it to the top-level plugins directory, or include the file '~${nonTopLevelPlugin[0]}' in your plugins config (https://nuxt.com/docs/api/configuration/nuxt-config#plugins-1) to remove this warning.`)
}
// Normalize full path to plugin
plugin.src = normalize(resolveAlias(plugin.src))
// Normalize mode
if (plugin.ssr) {
plugin.mode = 'server'
}
if (!plugin.mode) {
const [, mode = 'all'] = plugin.src.match(/\.(server|client)(\.\w+)*$/) || []
plugin.mode = mode as 'all' | 'client' | 'server'
}
return plugin
}
/**
* Registers a nuxt plugin and to the plugins array.
*
* Note: You can use mode or .client and .server modifiers with fileName option
* to use plugin only in client or server side.
*
* Note: By default plugin is prepended to the plugins array. You can use second argument to append (push) instead.
*
* @example
* ```js
* addPlugin({
* src: path.resolve(__dirname, 'templates/foo.js'),
* filename: 'foo.server.js' // [optional] only include in server bundle
* })
* ```
*/
export interface AddPluginOptions { append?: boolean }
export function addPlugin (_plugin: NuxtPlugin | string, opts: AddPluginOptions = {}): NuxtPlugin {
const nuxt = useNuxt()
// Normalize plugin
const plugin = normalizePlugin(_plugin)
// Remove any existing plugin with the same src
nuxt.options.plugins = nuxt.options.plugins.filter(p => normalizePlugin(p).src !== plugin.src)
// Prepend to array by default to be before user provided plugins since is usually used by modules
nuxt.options.plugins[opts.append ? 'push' : 'unshift'](plugin)
return plugin
}
/**
* Adds a template and registers as a nuxt plugin.
*/
export function addPluginTemplate (plugin: NuxtPluginTemplate | string, opts: AddPluginOptions = {}): NuxtPlugin {
const normalizedPlugin: NuxtPlugin = typeof plugin === 'string'
? { src: plugin }
// Update plugin src to template destination
: { ...plugin, src: addTemplate(plugin).dst! }
return addPlugin(normalizedPlugin, opts)
}
/**
* Renders given template using lodash template during build into the project buildDir
*/
export function addTemplate (_template: NuxtTemplate<any> | string): ResolvedNuxtTemplate<any> {
const nuxt = useNuxt()
// Normalize template
const template = normalizeTemplate(_template)
// Remove any existing template with the same filename
nuxt.options.build.templates = (nuxt.options.build.templates as any[])
.filter(p => normalizeTemplate(p).filename !== template.filename)
// Add to templates array
nuxt.options.build.templates.push(template)
return template
}
/**
* Normalize a nuxt template object
*/
export function normalizeTemplate (template: NuxtTemplate<any> | string): ResolvedNuxtTemplate<any> {
if (!template) {
throw new Error('Invalid template: ' + JSON.stringify(template))
}
// Normalize
if (typeof template === 'string') {
template = { src: template }
} else {
template = { ...template }
}
// Use src if provided
if (template.src) {
if (!existsSync(template.src)) {
throw new Error('Template not found: ' + template.src)
}
if (!template.filename) {
const srcPath = parse(template.src)
template.filename = (template as any).fileName ||
`${basename(srcPath.dir)}.${srcPath.name}.${hash(template.src)}${srcPath.ext}`
}
}
if (!template.src && !template.getContents) {
throw new Error('Invalid template. Either getContents or src options should be provided: ' + JSON.stringify(template))
}
if (!template.filename) {
throw new Error('Invalid template. Either filename should be provided: ' + JSON.stringify(template))
}
// Always write declaration files
if (template.filename.endsWith('.d.ts')) {
template.write = true
}
// Resolve dst
if (!template.dst) {
const nuxt = useNuxt()
template.dst = resolve(nuxt.options.buildDir, template.filename)
}
return template as ResolvedNuxtTemplate<any>
}
interface ExtendConfigOptions {
/**
* Install plugin on dev
*
* @default true
*/
dev?: boolean
/**
* Install plugin on build
*
* @default true
*/
build?: boolean
/**
* Install plugin on server side
*
* @default true
*/
server?: boolean
/**
* Install plugin on client side
*
* @default true
*/
client?: boolean
}
interface ExtendWebpackConfigOptions extends ExtendConfigOptions {}
/**
* Append webpack plugin to the config.
*/
export function addWebpackPlugin (plugin: WebpackPluginInstance | WebpackPluginInstance[], options?: ExtendWebpackConfigOptions): void {
extendWebpackConfig((config) => {
config.plugins = config.plugins || []
if (Array.isArray(plugin)) {
config.plugins.push(...plugin)
} else {
config.plugins.push(plugin)
}
}, options)
}
/**
* Extend webpack config
*
* The fallback function might be called multiple times
* when applying to both client and server builds.
*/
export function extendWebpackConfig (
fn: ((config: WebpackConfig) => void),
options: ExtendWebpackConfigOptions = {},
): void {
const nuxt = useNuxt()
if (options.dev === false && nuxt.options.dev) {
return
}
if (options.build === false && nuxt.options.build) {
return
}
nuxt.hook('webpack:config', (configs: WebpackConfig[]) => {
if (options.server !== false) {
const config = configs.find(i => i.name === 'server')
if (config) {
fn(config)
}
}
if (options.client !== false) {
const config = configs.find(i => i.name === 'client')
if (config) {
fn(config)
}
}
})
}
================================================
FILE: src/module.ts
================================================
import { fileURLToPath } from 'node:url'
import { defu } from 'defu'
import { resolvePath } from 'mlly'
import type { SentryWebpackPluginOptions } from '@sentry/webpack-plugin'
import { captureException, withScope } from '@sentry/node'
import type { Configuration as WebpackConfig } from 'webpack'
import { defineNuxtModule, isNuxt2, useLogger } from './kit-shim'
import { envToBool, boolToText, callOnce, canInitialize, clientSentryEnabled, serverSentryEnabled } from './utils'
import { buildHook, initializeServerSentry, shutdownServerSentry, webpackConfigHook } from './hooks'
import type { SentryHandlerProxy } from './options'
import type { ModuleConfiguration, ModuleOptions, ModulePublicRuntimeConfig } from './types'
export type { ModuleOptions, ModulePublicRuntimeConfig }
const logger = useLogger('nuxt:sentry')
const moduleDir = fileURLToPath(new URL('./', import.meta.url))
export default defineNuxtModule<ModuleConfiguration>({
meta: {
name: '@nuxtjs/sentry',
configKey: 'sentry',
},
defaults: nuxt => ({
lazy: false,
dsn: process.env.SENTRY_DSN || '',
disabled: envToBool(process.env.SENTRY_DISABLED) || false,
initialize: envToBool(process.env.SENTRY_INITIALIZE) || true,
runtimeConfigKey: 'sentry',
disableClientSide: envToBool(process.env.SENTRY_DISABLE_CLIENT_SIDE) || false,
disableServerSide: envToBool(process.env.SENTRY_DISABLE_SERVER_SIDE) || false,
publishRelease: envToBool(process.env.SENTRY_PUBLISH_RELEASE) || false,
disableServerRelease: envToBool(process.env.SENTRY_DISABLE_SERVER_RELEASE) || false,
disableClientRelease: envToBool(process.env.SENTRY_DISABLE_CLIENT_RELEASE) || false,
logMockCalls: true,
sourceMapStyle: 'hidden-source-map',
tracing: false,
clientIntegrations: {
ExtraErrorData: {},
ReportingObserver: { types: ['crash'] },
},
serverIntegrations: {
Dedupe: {},
ExtraErrorData: {},
RewriteFrames: { root: nuxt.options.rootDir },
},
customClientIntegrations: '',
customServerIntegrations: '',
config: {
environment: nuxt.options.dev ? 'development' : 'production',
},
serverConfig: {},
clientConfig: {},
requestHandlerConfig: {},
}),
async setup (options, nuxt) {
const defaultsPublishRelease: SentryWebpackPluginOptions = {
sourcemaps: {
ignore: [
'node_modules/**/*',
],
},
}
if (options.publishRelease) {
options.publishRelease = defu(options.publishRelease, defaultsPublishRelease)
}
if (canInitialize(options) && (clientSentryEnabled(options) || serverSentryEnabled(options))) {
const status = `(client side: ${boolToText(clientSentryEnabled(options))}, server side: ${boolToText(serverSentryEnabled(options))})`
logger.success(`Sentry reporting is enabled ${status}`)
} else {
let why: string
if (options.disabled) {
why = '"disabled" option has been set'
} else if (!options.dsn) {
why = 'no DSN has been provided'
} else if (!options.initialize) {
why = '"initialize" option has been set to false'
} else {
why = 'both client and server side clients are disabled'
}
logger.info(`Sentry reporting is disabled (${why})`)
}
// Work-around issues with Nuxt not being able to resolve unhoisted dependencies that are imported in webpack context.
const aliasedDependencies = [
'lodash.mergewith',
'@sentry/browser',
'@sentry/core',
'@sentry/integrations',
'@sentry/utils',
'@sentry/vue',
]
for (const dep of aliasedDependencies) {
nuxt.options.alias[`~${dep}`] = (await resolvePath(dep, { url: moduleDir })).replace(/\/cjs\//, '/esm/')
}
if (serverSentryEnabled(options)) {
/**
* Proxy that provides a dummy request handler before Sentry is initialized and gets replaced with Sentry's own
* handler after initialization. Otherwise server-side request tracing would not work as it depends on Sentry being
* initialized already during handler creation.
*/
const sentryHandlerProxy: SentryHandlerProxy = {
errorHandler: (error, _, __, next) => {
next(error)
},
requestHandler: (_, __, next) => {
next()
},
tracingHandler: (_, __, next) => {
next()
},
}
// @ts-expect-error Nuxt 2 only hook
nuxt.hook('render:setupMiddleware', app => app.use((req, res, next) => {
sentryHandlerProxy.requestHandler(req, res, next)
}))
if (options.tracing) {
// @ts-expect-error Nuxt 2 only hook
nuxt.hook('render:setupMiddleware', app => app.use((req, res, next) => {
sentryHandlerProxy.tracingHandler(req, res, next)
}))
}
// @ts-expect-error Nuxt 2 only hook
nuxt.hook('render:errorMiddleware', app => app.use((error, req, res, next) => {
sentryHandlerProxy.errorHandler(error, req, res, next)
}))
// @ts-expect-error Nuxt 2 only hook
nuxt.hook('generate:routeFailed', ({ route, errors }) => {
type routeGeneretorError = {
type: 'handled' | 'unhandled'
route: unknown
error: Error
}
(errors as routeGeneretorError[]).forEach(({ error }) => withScope((scope) => {
scope.setExtra('route', route)
captureException(error)
}))
})
// This is messy but Nuxt provides many modes that it can be started with like:
// - nuxt dev
// - nuxt build
// - nuxt start
// - nuxt generate
// but it doesn't really provide great way to differentiate those or enough hooks to
// pick from. This should ensure that server Sentry will only be initialized **after**
// the release version has been determined and the options template created but before
// the build is started (if building).
if (isNuxt2()) {
const isBuilding = nuxt.options._build && !nuxt.options.dev
const initHook = isBuilding ? 'build:compile' : 'ready'
nuxt.hook(initHook, () => initializeServerSentry(nuxt, options, sentryHandlerProxy, logger))
const shutdownHook = isBuilding ? 'build:done' : 'close'
const shutdownServerSentryOnce = callOnce(() => shutdownServerSentry())
nuxt.hook(shutdownHook, shutdownServerSentryOnce)
}
}
nuxt.hook('build:before', () => buildHook(nuxt, options, logger))
// Enable publishing of sourcemaps
if (options.publishRelease && !options.disabled && !nuxt.options.dev) {
if (isNuxt2()) {
nuxt.hook('webpack:config', (webpackConfigs: WebpackConfig[]) => webpackConfigHook(nuxt, webpackConfigs, options, logger))
}
}
},
}) as unknown /* casting to "unknown" prevents unnecessary types being exposed in the generated type definitions */
================================================
FILE: src/options.ts
================================================
import { fileURLToPath } from 'node:url'
import type { ConsolaInstance } from 'consola'
import { defu } from 'defu'
import initJiti from 'jiti'
import { relative } from 'pathe'
import { Integrations as SentryNodeIntegrations, autoDiscoverNodePerformanceMonitoringIntegrations } from '@sentry/node'
import type Sentry from '@sentry/node'
import * as SentryCore from '@sentry/core'
import * as PluggableIntegrations from '@sentry/integrations'
import type { Integration, Options } from '@sentry/types'
import type { LazyConfiguration, TracingConfiguration } from './types/configuration'
import type { AllIntegrations, BrowserIntegrations, ClientCoreIntegrations, ClientIntegrations, ClientPluggableIntegrations, NodeIntegrations, NodeProfilingIntegrations, ServerCoreIntegrations, ServerIntegrations, ServerPluggableIntegrations } from './types/sentry'
import type { ModuleConfiguration } from './types'
import { Nuxt, resolveAlias } from './kit-shim'
import { canInitialize } from './utils'
const jiti = initJiti(fileURLToPath(import.meta.url))
export interface SentryHandlerProxy {
errorHandler: ReturnType<typeof Sentry.Handlers.errorHandler>
requestHandler: ReturnType<typeof Sentry.Handlers.requestHandler>
tracingHandler: ReturnType<typeof Sentry.Handlers.tracingHandler>
}
type BooleanMap<T extends Record<string, unknown>> = Record<keyof T, true>
type IntegrationToImportMapping = Record<keyof AllIntegrations, string>
export const BROWSER_CORE_INTEGRATIONS: BooleanMap<ClientCoreIntegrations> = {
FunctionToString: true,
InboundFilters: true,
LinkedErrors: true,
}
// Enabled by default in Vue - https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/default/
export const BROWSER_INTEGRATIONS: BooleanMap<BrowserIntegrations> = {
Breadcrumbs: true,
GlobalHandlers: true,
HttpContext: true,
Replay: true,
TryCatch: true,
}
// Optional in Vue - https://docs.sentry.io/platforms/javascript/guides/vue/configuration/integrations/plugin/
export const BROWSER_PLUGGABLE_INTEGRATIONS: BooleanMap<ClientPluggableIntegrations> = {
CaptureConsole: true,
ContextLines: true,
Debug: true,
Dedupe: true,
ExtraErrorData: true,
HttpClient: true,
ReportingObserver: true,
RewriteFrames: true,
SessionTiming: true,
}
const SERVER_CORE_INTEGRATIONS: BooleanMap<ServerCoreIntegrations> = {
FunctionToString: true,
InboundFilters: true,
LinkedErrors: true,
RequestData: true,
}
// Enabled by default in Node.js - https://docs.sentry.io/platforms/node/configuration/integrations/default-integrations/
const SERVER_NODE_INTEGRATIONS: BooleanMap<NodeIntegrations> = {
Anr: true,
Apollo: true,
Console: true,
Context: true,
ContextLines: true,
Express: true,
GraphQL: true,
Hapi: true,
Http: true,
LocalVariables: true,
Modules: true,
Mongo: true,
Mysql: true,
OnUncaughtException: true,
OnUnhandledRejection: true,
Postgres: true,
Prisma: true,
Spotlight: true,
Undici: true,
}
// Optional in Node.js - https://docs.sentry.io/platforms/node/configuration/integrations/pluggable-integrations/
const SERVER_PLUGGABLE_INTEGRATIONS: BooleanMap<ServerPluggableIntegrations> = {
CaptureConsole: true,
Debug: true,
Dedupe: true,
ExtraErrorData: true,
HttpClient: true,
ReportingObserver: true,
RewriteFrames: true,
SessionTiming: true,
}
const INTEGRATION_TO_IMPORT_NAME_MAP: IntegrationToImportMapping = {
Anr: 'Anr',
Apollo: 'Apollo',
Breadcrumbs: 'breadcrumbsIntegration',
CaptureConsole: 'captureConsoleIntegration',
Console: 'Console',
Context: 'Context',
ContextLines: 'contextLinesIntegration',
Debug: 'debugIntegration',
Dedupe: 'dedupeIntegration',
Express: 'Express',
ExtraErrorData: 'extraErrorDataIntegration',
FunctionToString: 'functionToStringIntegration',
GlobalHandlers: 'globalHandlersIntegration',
GraphQL: 'GraphQL',
Hapi: 'Hapi',
Http: 'Http',
HttpClient: 'httpClientIntegration',
HttpContext: 'httpContextIntegration',
InboundFilters: 'inboundFiltersIntegration',
LinkedErrors: 'linkedErrorsIntegration',
LocalVariables: 'LocalVariables',
Modules: 'Modules',
Mongo: 'Mongo',
Mysql: 'Mysql',
OnUncaughtException: 'OnUncaughtException',
OnUnhandledRejection: 'OnUnhandledRejection',
Postgres: 'Postgres',
Prisma: 'Prisma',
ProfilingIntegration: 'ProfilingIntegration',
Replay: 'replayIntegration',
ReportingObserver: 'reportingObserverIntegration',
RequestData: 'requestDataIntegration',
RewriteFrames: 'rewriteFramesIntegration',
SessionTiming: 'sessionTimingIntegration',
Spotlight: 'Spotlight',
TryCatch: 'browserApiErrorsIntegration',
Undici: 'Undici',
}
function mapClientIntegrationToImportName (key: keyof ClientIntegrations): string {
return INTEGRATION_TO_IMPORT_NAME_MAP[key]
}
function mapServerIntegrationToImportName (key: keyof ServerIntegrations): string {
if (key === 'ContextLines') {
return 'ContextLines'
}
return INTEGRATION_TO_IMPORT_NAME_MAP[key]
}
// External and optional Node.js integration - https://docs.sentry.io/platforms/node/profiling/
export const SERVER_PROFILING_INTEGRATION: keyof Pick<NodeProfilingIntegrations, 'ProfilingIntegration'> = 'ProfilingIntegration'
function getEnabledIntegrations<T extends AllIntegrations> (integrations: T): (keyof T)[] {
return getIntegrationsKeys(integrations).filter(key => integrations[key])
}
function getDisabledIntegrationKeys<T extends AllIntegrations> (integrations: T): string[] {
return getIntegrationsKeys(integrations).filter(key => integrations[key] === false) as string[]
}
function getIntegrationsKeys<T extends Partial<Record<keyof AllIntegrations, unknown>>> (integrations: T): (keyof T)[] {
return Object.keys(integrations) as (keyof T)[]
}
function isBrowserCoreIntegration (name: string): name is keyof ClientCoreIntegrations {
return name in BROWSER_CORE_INTEGRATIONS
}
function isBrowserDefaultIntegration (name: string): name is keyof BrowserIntegrations {
return name in BROWSER_INTEGRATIONS
}
function isBrowserPluggableIntegration (name: string): name is keyof ClientPluggableIntegrations {
return name in BROWSER_PLUGGABLE_INTEGRATIONS
}
function isServerCoreIntegration (name: string): name is keyof ServerCoreIntegrations {
return name in SERVER_CORE_INTEGRATIONS
}
function isServerNodeIntegration (name: string): name is keyof NodeIntegrations {
return name in SERVER_NODE_INTEGRATIONS
}
function isServerPlugabbleIntegration (name: string): name is keyof ServerPluggableIntegrations {
return name in SERVER_PLUGGABLE_INTEGRATIONS
}
async function getApiMethods (packageName: string): Promise<string[]> {
const packageApi = await import(packageName)
const apiMethods: string[] = []
for (const key in packageApi) {
if (key === 'default') {
for (const subKey in packageApi[key]) {
if (typeof packageApi[key][subKey] === 'function') {
apiMethods.push(subKey)
}
}
continue
}
if (typeof packageApi[key] === 'function') {
apiMethods.push(key)
}
}
return apiMethods
}
export async function resolveRelease (moduleOptions: Readonly<ModuleConfiguration>): Promise<string | undefined> {
if (!('release' in moduleOptions.config)) {
// Determine "config.release" automatically from local repo if not provided.
try {
const SentryCli = await import('@sentry/cli').then(m => m.default || m)
const cli = new SentryCli()
return (await cli.releases.proposeVersion()).trim()
} catch {
// Ignore
}
}
}
function resolveClientLazyOptions (options: ModuleConfiguration, apiMethods: string[], logger: ConsolaInstance): void {
if (!options.lazy) {
return
}
const defaultLazyOptions: LazyConfiguration = {
injectMock: true,
injectLoadHook: false,
mockApiMethods: true,
chunkName: 'sentry',
webpackPrefetch: false,
webpackPreload: false,
}
options.lazy = defu(options.lazy, defaultLazyOptions)
if (!options.lazy.injectMock) {
options.lazy.mockApiMethods = []
} else if (options.lazy.mockApiMethods === true) {
options.lazy.mockApiMethods = apiMethods
} else if (Array.isArray(options.lazy.mockApiMethods)) {
const mockMethods = options.lazy.mockApiMethods
options.lazy.mockApiMethods = mockMethods.filter(method => apiMethods.includes(method))
const notfoundMethods = mockMethods.filter(method => !apiMethods.includes(method))
if (notfoundMethods.length) {
logger.warn('Some specified methods to mock weren\'t found in @sentry/vue:', notfoundMethods)
}
if (!options.lazy.mockApiMethods.includes('captureException')) {
// always add captureException if a sentry mock is requested
options.lazy.mockApiMethods.push('captureException')
}
}
}
function resolveTracingOptions (options: ModuleConfiguration): void {
if (!options.tracing) {
return
}
const defaultTracingOptions: TracingConfiguration = {
tracesSampleRate: 1.0,
browserTracing: {},
vueOptions: {
trackComponents: true,
},
vueRouterInstrumentationOptions: {
routeLabel: 'name',
},
}
options.tracing = defu(options.tracing, defaultTracingOptions)
if (options.config.tracesSampleRate === undefined) {
options.config.tracesSampleRate = options.tracing.tracesSampleRate
}
}
export type ResolvedClientOptions = {
dev: boolean
DISABLED_INTEGRATION_KEYS: string[]
runtimeConfigKey: string
config: Options
lazy: boolean | LazyConfiguration
apiMethods: string[]
clientConfigPath: string | undefined
customClientIntegrations: string | undefined
logMockCalls: boolean
tracing: boolean | TracingConfiguration
imports: Record<string, string[]>
initialize: boolean
integrations: Record<string, unknown>
}
export async function resolveClientOptions (nuxt: Nuxt, moduleOptions: Readonly<ModuleConfiguration>, logger: ConsolaInstance): Promise<ResolvedClientOptions> {
const options: ModuleConfiguration = defu(moduleOptions)
let clientConfigPath: string | undefined
if (typeof options.clientConfig === 'string') {
clientConfigPath = resolveAlias(options.clientConfig)
clientConfigPath = relative(nuxt.options.buildDir, clientConfigPath)
} else {
options.config = defu(options.clientConfig, options.config)
}
const apiMethods = await getApiMethods('@sentry/vue')
resolveClientLazyOptions(options, apiMethods, logger)
resolveTracingOptions(options)
for (const name of getIntegrationsKeys(options.clientIntegrations)) {
if (!isBrowserDefaultIntegration(name) && !isBrowserCoreIntegration(name) && !isBrowserPluggableIntegration(name)) {
logger.warn(`Sentry clientIntegration "${name}" is not recognized and will be ignored.`)
delete options.clientIntegrations[name]
}
}
let customClientIntegrations: string | undefined
if (options.customClientIntegrations) {
if (typeof options.customClientIntegrations === 'string') {
customClientIntegrations = resolveAlias(options.customClientIntegrations)
customClientIntegrations = relative(nuxt.options.buildDir, customClientIntegrations)
} else {
logger.warn(`Invalid customClientIntegrations option. Expected a file path, got "${typeof options.customClientIntegrations}".`)
}
}
const importsBrowser: string[] = []
const importsCore: string[] = []
const importsPluggable: string[] = []
const integrations = getEnabledIntegrations<ClientIntegrations>(options.clientIntegrations)
.reduce((res, key) => {
const importName = mapClientIntegrationToImportName(key)
if (key in BROWSER_INTEGRATIONS) {
importsBrowser.push(importName)
} else if (key in BROWSER_CORE_INTEGRATIONS) {
importsCore.push(importName)
} else if (key in BROWSER_PLUGGABLE_INTEGRATIONS) {
importsPluggable.push(importName)
}
res[importName] = options.clientIntegrations[key]
return res
}, {} as Record<string, unknown>)
const imports = {
'~@sentry/browser': importsBrowser,
'~@sentry/core': importsCore,
'~@sentry/integrations': importsPluggable,
'~@sentry/vue': ['init', ...options.tracing ? ['browserTracingIntegration'] : []],
}
return {
dev: nuxt.options.dev,
runtimeConfigKey: options.runtimeConfigKey,
config: {
dsn: options.dsn,
...options.config,
},
clientConfigPath,
DISABLED_INTEGRATION_KEYS: getDisabledIntegrationKeys(options.clientIntegrations),
lazy: options.lazy,
apiMethods,
customClientIntegrations,
logMockCalls: options.logMockCalls, // for mocked only
tracing: options.tracing,
imports,
initialize: canInitialize(options),
integrations,
}
}
export type ResolvedServerOptions = {
config: Options
apiMethods: string[]
lazy: boolean | LazyConfiguration
logMockCalls: boolean
tracing: ModuleConfiguration['tracing']
}
export async function resolveServerOptions (nuxt: Nuxt, moduleOptions: Readonly<ModuleConfiguration>, logger: ConsolaInstance): Promise<ResolvedServerOptions> {
const options: ModuleConfiguration = defu(moduleOptions)
if (options.tracing) {
resolveTracingOptions(options)
options.serverIntegrations = defu(options.serverIntegrations, { Http: { tracing: true } })
}
if (typeof options.serverConfig === 'string') {
const resolvedPath = resolveAlias(options.serverConfig)
try {
const mod = jiti(resolvedPath)
options.serverConfig = (mod.default || mod)()
} catch (error) {
logger.error(`Error handling the serverConfig plugin:\n${error}`)
}
}
options.config = defu(getServerRuntimeConfig(nuxt, options), options.serverConfig, options.config)
for (const name of getIntegrationsKeys(options.serverIntegrations)) {
if (!isServerNodeIntegration(name) && !isServerCoreIntegration(name) && !isServerPlugabbleIntegration(name) && name !== SERVER_PROFILING_INTEGRATION) {
logger.warn(`Sentry serverIntegration "${name}" is not recognized and will be ignored.`)
delete options.serverIntegrations[name]
}
}
let customIntegrations: Integration[] = []
if (options.customServerIntegrations) {
const resolvedPath = resolveAlias(options.customServerIntegrations)
try {
const mod = jiti(resolvedPath)
customIntegrations = (mod.default || mod)()
if (!Array.isArray(customIntegrations)) {
logger.error(`Invalid value returned from customServerIntegrations plugin. Expected an array, got "${typeof customIntegrations}".`)
}
} catch (error) {
logger.error(`Error handling the customServerIntegrations plugin:\n${error}`)
}
}
if (SERVER_PROFILING_INTEGRATION in options.serverIntegrations) {
const enabled = options.serverIntegrations[SERVER_PROFILING_INTEGRATION]
delete options.serverIntegrations[SERVER_PROFILING_INTEGRATION]
if (enabled) {
try {
const { ProfilingIntegration } = await import('@sentry/profiling-node').then(m => m.default || m)
customIntegrations.push(new ProfilingIntegration())
} catch (error) {
logger.error(`To use the ${SERVER_PROFILING_INTEGRATION} integration you need to install the "@sentry/profiling-node" dependency.`)
throw new Error((error as Error).message)
}
}
}
const resolvedIntegrations = [
// Automatically instrument Node.js libraries and frameworks
...options.tracing ? autoDiscoverNodePerformanceMonitoringIntegrations() : [],
...getEnabledIntegrations(options.serverIntegrations)
.map((name) => {
const importName = mapServerIntegrationToImportName(name)
const opt = options.serverIntegrations[name]
try {
if (isServerCoreIntegration(name)) {
// @ts-expect-error Some integrations don't take arguments but it doesn't hurt to pass one.
return Object.keys(opt as Record<string, unknown>).length ? SentryCore[importName](opt) : SentryCore[importName]()
} else if (isServerNodeIntegration(name)) {
// @ts-expect-error Some integrations don't take arguments but it doesn't hurt to pass one.
return Object.keys(opt as Record<string, unknown>).length ? new SentryNodeIntegrations[name](opt) : new SentryNodeIntegrations[name]()
} else if (isServerPlugabbleIntegration(name)) {
// @ts-expect-error Some integrations don't take arguments but it doesn't hurt to pass one.
return Object.keys(opt as Record<string, unknown>).length ? PluggableIntegrations[importName](opt) : PluggableIntegrations[importName]()
} else {
throw new Error(`Unsupported server integration "${name}"`)
}
} catch (error) {
throw new Error(`Failed initializing server integration "${name}".\n${error}`)
}
}),
...customIntegrations,
]
const disabledIntegrationKeys = getDisabledIntegrationKeys(options.serverIntegrations)
// Use a function to be able to filter out default integrations.
options.config.integrations = (defaultIntegrations) => {
return [
...defaultIntegrations.filter(integration => !disabledIntegrationKeys.includes(integration.name)),
...resolvedIntegrations,
]
}
return {
config: {
dsn: options.dsn,
...options.config,
},
apiMethods: await getApiMethods('@sentry/node'),
lazy: options.lazy,
logMockCalls: options.logMockCalls, // for mocked only
tracing: options.tracing,
}
}
function getServerRuntimeConfig (nuxt: Nuxt, options: Readonly<ModuleConfiguration>): Partial<ModuleConfiguration['config']> | undefined {
const { publicRuntimeConfig } = nuxt.options
const { runtimeConfigKey } = options
if (publicRuntimeConfig && typeof publicRuntimeConfig !== 'function' && runtimeConfigKey in publicRuntimeConfig) {
return defu(
publicRuntimeConfig[runtimeConfigKey].serverConfig as Partial<ModuleConfiguration['serverConfig']>,
publicRuntimeConfig[runtimeConfigKey].config as Partial<ModuleConfiguration['config']>,
)
}
}
================================================
FILE: src/templates/client.shared.js
================================================
import merge from '~lodash.mergewith'
import * as CoreSdk from '~@sentry/core'
import { captureUserFeedback, forceLoad, onLoad, showReportDialog, wrap } from '~@sentry/browser'
<%
for (const [package, imports] of Object.entries(options.imports)) {
if (imports.length) {
%>import { <%= imports.join(', ') %> } from '<%= package %>'
<%
}
}
if (options.clientConfigPath) {%>import getClientConfig from '<%= options.clientConfigPath %>'
<%}
if (options.customClientIntegrations) {%>import getCustomIntegrations from '<%= options.customClientIntegrations %>'
<%}%>
export { init }
export const SentrySdk = { ...CoreSdk, ...{ captureUserFeedback, forceLoad, onLoad, showReportDialog, wrap } }
/** @type {string[]} */
const DISABLED_INTEGRATION_KEYS = <%= serialize(options.DISABLED_INTEGRATION_KEYS) %>
/**
* @typedef {Parameters<typeof init>[0]} InitConfig
* @param {import('@nuxt/types').Context} ctx
* @return {Promise<InitConfig>}
*/
export<%= (options.clientConfigPath || options.customClientIntegrations) ? ' async' : '' %> function getConfig (ctx) {
/** @type {InitConfig} */
const config = {
<%= Object
.entries(options.config)
.map(([key, option]) => {
const value = typeof option === 'function' ? serializeFunction(option) : serialize(option)
return `${key}:${value}`
})
.join(',\n ') %>,
}
/** @type {NonNullable<InitConfig>['integrations']} */
const resolvedIntegrations = [
<%= Object
.entries(options.integrations)
.filter(([name]) => name !== 'Vue')
.map(([name, integration]) => {
const integrationOptions = Object
.entries(integration)
.map(([key, option]) => {
const value = typeof option === 'function' ? serializeFunction(option) : serialize(option)
return `${key}:${value}`
})
return `${name}(${integrationOptions.length ? '{ ' + integrationOptions.join(',') + ' }' : ''})`
})
.join(',\n ') %>,
]
<%
if (options.tracing) {
const { browserTracing, vueOptions, vueRouterInstrumentationOptions, ...tracingOptions } = options.tracing
%>
resolvedIntegrations.push(browserTracingIntegration({
router: ctx.app.router,
...<%= serialize(vueRouterInstrumentationOptions) %>,
...<%= serialize(browserTracing) %>,
}))
merge(config, <%= serialize(vueOptions) %>, <%= serialize(tracingOptions) %>)
<% } %>
<% if (options.clientConfigPath) { %>
const clientConfig = await getClientConfig(ctx)
clientConfig ? merge(config, clientConfig) : console.error(`[@nuxtjs/sentry] Invalid value returned from the clientConfig plugin.`)
<% } %>
<% if (options.customClientIntegrations) { %>
const customIntegrations = await getCustomIntegrations(ctx)
if (Array.isArray(customIntegrations)) {
resolvedIntegrations.push(...customIntegrations)
} else {
console.error(`[@nuxtjs/sentry] Invalid value returned from customClientIntegrations plugin. Expected an array, got "${typeof customIntegrations}".`)
}
<% } %>
config.integrations = (defaultIntegrations) => {
return [
...defaultIntegrations.filter(integration => !DISABLED_INTEGRATION_KEYS.includes(integration.name)),
...resolvedIntegrations,
]
}
const runtimeConfigKey = <%= serialize(options.runtimeConfigKey) %>
if (ctx.$config && runtimeConfigKey && ctx.$config[runtimeConfigKey]) {
merge(config, ctx.$config[runtimeConfigKey].config, ctx.$config[runtimeConfigKey].clientConfig)
}
return config
}
================================================
FILE: src/templates/options.ejs
================================================
/* eslint-disable */
<%
for (const [key, value] of Object.entries(options)) {
%>export const <%= key %> = <%= serialize(value) %>
<%
}
%>
================================================
FILE: src/templates/plugin.client.js
================================================
import Vue from 'vue'
import { getConfig, init, SentrySdk } from './sentry.client.shared'
/** @type {import('@nuxt/types').Plugin} */
export default async function (ctx, inject) {
const config = await getConfig(ctx)
init({ Vue, ...config })
inject('sentry', SentrySdk)
ctx.$sentry = SentrySdk
}
================================================
FILE: src/templates/plugin.lazy.js
================================================
import Vue from 'vue'
<% if (options.lazy.injectMock) { %>
const API_METHODS = <%= JSON.stringify(options.lazy.mockApiMethods)%>
let delayedCalls = []
let SentryMock = {}
<% } %>
let sentryReadyResolve
let loadInitiated = false
let loadCompleted = false
<% if (options.lazy.injectMock) { %>
let delayedGlobalErrors = []
let delayedUnhandledRejections = []
/** @param {ErrorEvent} event */
const delayGlobalError = function (event) {
delayedGlobalErrors.push([event.message, event.filename, event.lineno, event.colno, event.error])
}
const delayUnhandledRejection = function (event) {
if ('reason' in event && event.reason) {
event = event.reason
} else if ('detail' in event && event.detail && 'reason' in event.detail && event.detail.reason) {
event = event.detail.reason
}
delayedUnhandledRejections.push(event)
}
const vueErrorHandler = Vue.config.errorHandler
Vue.config.errorHandler = (error, vm, info) => {
if (!loadCompleted) {
if (vm) {
vm.$sentry.captureException(error)
}
if (Vue.util) {
Vue.util.warn(`Error in ${info}: "${error.toString()}"`, vm)
}
console.error(error)
}
if (vueErrorHandler) {
return vueErrorHandler(error, vm, info)
}
}
<% } %>
export default function SentryPlugin (ctx, inject) {
<% if (options.lazy.injectMock) { %>
API_METHODS.forEach((key) => {
SentryMock[key] = (...args) => delayedCalls.push([key, args])
})
window.addEventListener('error', delayGlobalError)
window.addEventListener('unhandledrejection', delayUnhandledRejection)
inject('sentry', SentryMock)
ctx.$sentry = SentryMock
<% } %>
const loadSentryHook = () => attemptLoadSentry(ctx, inject)
<% if (options.lazy.injectLoadHook) { %>
inject('sentryLoad', loadSentryHook)
ctx.$sentryLoad = loadSentryHook
<% } else { %>
window.<%= globals.readyCallback %>(loadSentryHook)
<% } %>
const sentryReadyPromise = new Promise((resolve) => {
sentryReadyResolve = resolve
})
const sentryReady = () => sentryReadyPromise
inject('sentryReady', sentryReady)
ctx.$sentryReady = sentryReady
}
async function attemptLoadSentry (ctx, inject) {
if (loadInitiated) {
return
}
loadInitiated = true
if (!window.<%= globals.nuxt %>) {
<% if (options.dev) { %>
console.warn('$sentryLoad was called but window.<%= globals.nuxt %> is not available, delaying sentry loading until onNuxtReady callback. Do you really need to use lazy loading for Sentry?')
<% }
if (options.lazy.injectLoadHook) { %>window.<%= globals.readyCallback %>(() => loadSentry(ctx, inject))
<% } else { %>// Wait for onNuxtReady hook to trigger.
<% } %>return
}
await loadSentry(ctx, inject)
}
async function loadSentry (ctx, inject) {
if (loadCompleted) {
return
}
<%
const magicComments = [`webpackChunkName: '${options.lazy.chunkName}'`]
if (options.lazy.webpackPrefetch) {
magicComments.push('webpackPrefetch: true')
}
if (options.lazy.webpackPreload) {
magicComments.push('webpackPreload: true')
}
%>
const { getConfig, init, SentrySdk } = await import(/* <%= magicComments.join(', ') %> */ './sentry.client.shared')
<% if (options.initialize) {%>
const config = await getConfig(ctx)
init({ Vue, ...config })
<% } %>
loadCompleted = true
<% if (options.lazy.injectMock) { %>
window.removeEventListener('error', delayGlobalError)
window.removeEventListener('unhandledrejection', delayUnhandledRejection)
if (delayedGlobalErrors.length) {
if (window.onerror) {
console.info('Reposting global errors after Sentry has loaded')
for (const errorArgs of delayedGlobalErrors) {
window.onerror.apply(window, errorArgs)
}
}
delayedGlobalErrors = []
}
if (delayedUnhandledRejections.length) {
if (window.onunhandledrejection) {
console.info('Reposting unhandled promise rejection errors after Sentry has loaded')
for (const reason of delayedUnhandledRejections) {
window.onunhandledrejection(reason)
}
}
delayedUnhandledRejections = []
}
delayedCalls.forEach(([methodName, args]) => SentrySdk[methodName].apply(SentrySdk, args))
<% } %>
forceInject(ctx, inject, 'sentry', SentrySdk)
sentryReadyResolve(SentrySdk)
// help gc
<% if (options.lazy.injectMock) { %>
// Avoid crashes in case the reference to the mocked object is being used after the actual Sentry instance has loaded.
API_METHODS.forEach((key) => {
SentryMock[key] = (...args) => SentrySdk[key].apply(SentrySdk, args)
})
// Dont unset delayedCalls & SentryMock during development - this will cause HMR issues.
<% if (!options.dev) { %>
delayedCalls = undefined
SentryMock = undefined
<% } else { %>
delayedCalls = []
<% } %>
<% } %>
sentryReadyResolve = undefined
}
// Custom inject function that is able to overwrite previously injected values,
// which original inject doesn't allow to do.
// This method is adapted from the inject method in nuxt/vue-app/template/index.js
function forceInject (ctx, inject, key, value) {
inject(key, value)
const injectKey = '$' + key
ctx[injectKey] = value
window.<%= globals.nuxt %>.$options[injectKey] = value
}
================================================
FILE: src/templates/plugin.mocked.js
================================================
const apiMethods = <%= JSON.stringify(options.apiMethods)%>
/** @type {import('@nuxt/types').Plugin} */
export default function (ctx, inject) {
const SentryMock = {}
apiMethods.forEach(key => {
SentryMock[key] = <%= options.logMockCalls
? '(...args) => console.warn(`$sentry.${key}() called, but Sentry plugin is disabled. Arguments:`, args)'
: '_ => _'%>
})
// Inject mocked sentry to the context as $sentry (this is used in case sentry is disabled)
inject('sentry', SentryMock)
ctx.$sentry = SentryMock
}
================================================
FILE: src/templates/plugin.server.js
================================================
<% if (options.tracing) { %>
import { getActiveSpan, getDynamicSamplingContextFromSpan, spanToTraceHeader } from '~@sentry/core'
import { dynamicSamplingContextToSentryBaggageHeader } from '~@sentry/utils'
<% } %>
/** @type {import('@nuxt/types').Plugin} */
export default function (ctx, inject) {
const sentry = process.sentry || null
if (!sentry) {
return
}
inject('sentry', sentry)
ctx.$sentry = sentry
<% if (options.tracing) { %>
connectBackendTraces(ctx)
<% } %>
<% if (options.lazy) { %>
const sentryReady = () => Promise.resolve(sentry)
inject('sentryReady', sentryReady)
ctx.$sentryReady = sentryReady
<% } %>
}
<% if (options.tracing) { %>
/** @param {import('@nuxt/types').Context} ctx */
function connectBackendTraces (ctx) {
const { head } = ctx.app
if (!head || head instanceof Function) {
console.warn('[@nuxtjs/sentry] can not connect backend and frontend traces because app.head is a function or missing!')
return
}
const span = getActiveSpan()
if (!span) {
return
}
head.meta = head.meta || []
head.meta.push({ hid: 'sentry-trace', name: 'sentry-trace', content: spanToTraceHeader(span) })
const dsc = getDynamicSamplingContextFromSpan(span)
if (dsc) {
const baggage = dynamicSamplingContextToSentryBaggageHeader(dsc)
if (baggage) {
head.meta.push({ hid: 'sentry-baggage', name: 'baggage', content: baggage })
}
}
}
<% } %>
================================================
FILE: src/types/configuration.d.ts
================================================
import { Options as SentryOptions } from '@sentry/types'
import { browserTracingIntegration, vueRouterInstrumentation } from '@sentry/vue'
import { Options as SentryVueOptions, TracingOptions as SentryVueTracingOptions } from '@sentry/vue/types/types'
import { SentryWebpackPluginOptions } from '@sentry/webpack-plugin'
import { NodeOptions, Handlers } from '@sentry/node'
import { Configuration as WebpackOptions } from 'webpack'
import { ClientIntegrations, ServerIntegrations } from './sentry'
export interface LazyConfiguration {
chunkName?: string
injectLoadHook?: boolean
injectMock?: boolean
mockApiMethods?: boolean | string[]
webpackPrefetch?: boolean
webpackPreload?: boolean
}
export interface TracingConfiguration extends Pick<SentryOptions, 'tracesSampleRate'> {
browserTracing?: Parameters<typeof browserTracingIntegration>[0]
vueOptions?: Partial<SentryVueTracingOptions>
vueRouterInstrumentationOptions?: Parameters<typeof vueRouterInstrumentation>[1]
}
export interface ModuleConfiguration {
clientConfig: Partial<SentryVueOptions> | string
clientIntegrations: ClientIntegrations
config: SentryOptions
customClientIntegrations: string
customServerIntegrations: string
disableClientRelease: boolean
disableClientSide: boolean
disabled: boolean
disableServerRelease: boolean
disableServerSide: boolean
dsn: string
tracing: boolean | TracingConfiguration
initialize: boolean
lazy: boolean | LazyConfiguration
logMockCalls: boolean
/** See available options at https://docs.sentry.io/platforms/node/sourcemaps/uploading/webpack/ */
publishRelease: boolean | SentryWebpackPluginOptions
runtimeConfigKey: string
serverConfig: NodeOptions | string
serverIntegrations: ServerIntegrations
sourceMapStyle: WebpackOptions['devtool']
requestHandlerConfig: Handlers.RequestHandlerOptions
}
export type PartialModuleConfiguration = Partial<ModuleConfiguration>
================================================
FILE: src/types/extend.d.ts
================================================
import 'vue'
import 'vuex'
import '@nuxt/types'
import * as SentryNode from '@sentry/node'
import * as SentryTypes from '@sentry/core'
import { PartialModuleConfiguration } from './configuration'
export type ModulePublicRuntimeConfig = Pick<PartialModuleConfiguration, 'config' | 'clientConfig' | 'serverConfig'>
type Sentry = typeof SentryTypes
type NodeSentry = typeof SentryNode
// add type to Vue context
declare module 'vue/types/vue' {
interface Vue {
readonly $sentry: Sentry
$sentryLoad(): Promise<void>
$sentryReady(): Promise<Sentry>
}
}
// App Context and NuxtAppOptions
declare module '@nuxt/types' {
interface Context {
readonly $sentry: Sentry
$sentryLoad(): Promise<void>
$sentryReady(): Promise<Sentry>
}
interface NuxtOptions {
sentry?: PartialModuleConfiguration
}
interface NuxtAppOptions {
readonly $sentry: Sentry
$sentryLoad(): Promise<void>
$sentryReady(): Promise<Sentry>
}
}
declare module '@nuxt/types/config/runtime' {
interface NuxtRuntimeConfig {
sentry?: ModulePublicRuntimeConfig
}
}
// add types for Vuex Store
declare module 'vuex/types' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Store<S> {
readonly $sentry: Sentry
$sentryLoad(): Promise<void>
$sentryReady(): Promise<Sentry>
}
}
declare global {
namespace NodeJS {
interface Process {
sentry: NodeSentry
}
}
}
================================================
FILE: src/types/index.d.ts
================================================
import { PartialModuleConfiguration, ModuleConfiguration } from './configuration'
import { ModulePublicRuntimeConfig } from './extend'
type ModuleOptions = PartialModuleConfiguration
export { ModuleOptions, ModulePublicRuntimeConfig, ModuleConfiguration }
================================================
FILE: src/types/sentry.d.ts
================================================
import { IntegrationFn, IntegrationClass, Integration } from '@sentry/types'
import {
breadcrumbsIntegration,
browserApiErrorsIntegration,
globalHandlersIntegration,
httpContextIntegration,
replayIntegration,
} from '@sentry/browser'
import {
functionToStringIntegration,
inboundFiltersIntegration,
linkedErrorsIntegration,
requestDataIntegration,
} from '@sentry/core'
import {
captureConsoleIntegration,
contextLinesIntegration,
debugIntegration,
dedupeIntegration,
extraErrorDataIntegration,
httpClientIntegration,
reportingObserverIntegration,
rewriteFramesIntegration,
sessionTimingIntegration,
} from '@sentry/integrations'
import {
Integrations,
} from '@sentry/node'
type IntegrationConfig<T extends IntegrationFn> = Parameters<T>[0] | Record<string, never> | false
type ClassIntegrationConfig<T extends IntegrationClass<Integration>> = ConstructorParameters<T>[0] | Record<string, never> | false
export type BrowserIntegrations = {
Breadcrumbs?: IntegrationConfig<typeof breadcrumbsIntegration>
GlobalHandlers?: IntegrationConfig<typeof globalHandlersIntegration>
HttpContext?: IntegrationConfig<typeof httpContextIntegration>
Replay?: IntegrationConfig<typeof replayIntegration>
TryCatch?: IntegrationConfig<typeof browserApiErrorsIntegration>
}
export type CoreIntegrations = {
FunctionToString?: IntegrationConfig<typeof functionToStringIntegration>
InboundFilters?: IntegrationConfig<typeof inboundFiltersIntegration>
LinkedErrors?: IntegrationConfig<typeof linkedErrorsIntegration>
RequestData?: IntegrationConfig<typeof requestDataIntegration>
}
export type PluggableIntegrations = {
CaptureConsole?: IntegrationConfig<typeof captureConsoleIntegration>
ContextLines?: IntegrationConfig<typeof contextLinesIntegration>
Debug?: IntegrationConfig<typeof debugIntegration>
Dedupe?: IntegrationConfig<typeof dedupeIntegration>
ExtraErrorData?: IntegrationConfig<typeof extraErrorDataIntegration>
HttpClient?: IntegrationConfig<typeof httpClientIntegration>
ReportingObserver?: IntegrationConfig<typeof reportingObserverIntegration>
RewriteFrames?: IntegrationConfig<typeof rewriteFramesIntegration>
SessionTiming?: IntegrationConfig<typeof sessionTimingIntegration>
}
export type NodeProfilingIntegrations = {
ProfilingIntegration?: IntegrationConfig<IntegrationFn> // Dummy type since we don't want to depend on `@sentry/profiling-node`
}
export type NodeIntegrations = {
Anr?: ClassIntegrationConfig<typeof Integrations.Anr>
Apollo?: ClassIntegrationConfig<typeof Integrations.Apollo>
Console?: ClassIntegrationConfig<typeof Integrations.Console>
Context?: ClassIntegrationConfig<typeof Integrations.Context>
ContextLines?: ClassIntegrationConfig<typeof Integrations.ContextLines>
Express?: ClassIntegrationConfig<typeof Integrations.Express>
GraphQL?: ClassIntegrationConfig<typeof Integrations.GraphQL>
Hapi?: ClassIntegrationConfig<typeof Integrations.Hapi>
Http?: ClassIntegrationConfig<typeof Integrations.Http>
LocalVariables?: ClassIntegrationConfig<typeof Integrations.LocalVariables>
Modules?: ClassIntegrationConfig<typeof Integrations.Modules>
Mongo?: ClassIntegrationConfig<typeof Integrations.Mongo>
Mysql?: ClassIntegrationConfig<typeof Integrations.Mysql>
OnUncaughtException?: ClassIntegrationConfig<typeof Integrations.OnUncaughtException>
OnUnhandledRejection?: ClassIntegrationConfig<typeof Integrations.OnUnhandledRejection>
Postgres?: ClassIntegrationConfig<typeof Integrations.Postgres>
Prisma?: ClassIntegrationConfig<typeof Integrations.Prisma>
Spotlight?: ClassIntegrationConfig<typeof Integrations.Spotlight>
Undici?: ClassIntegrationConfig<typeof Integrations.Undici>
}
export type ClientCoreIntegrations = Pick<CoreIntegrations, 'FunctionToString' | 'InboundFilters' | 'LinkedErrors'>
export type ClientPluggableIntegrations = PluggableIntegrations
export type ClientIntegrations = ClientCoreIntegrations & ClientPluggableIntegrations & BrowserIntegrations
export type ServerCoreIntegrations = CoreIntegrations
export type ServerPluggableIntegrations = Omit<PluggableIntegrations, 'ContextLines'>
export type ServerIntegrations = ServerCoreIntegrations & ServerPluggableIntegrations & NodeProfilingIntegrations & NodeIntegrations
export type AllIntegrations = ClientIntegrations & ServerIntegrations
================================================
FILE: src/utils.ts
================================================
import type { ModuleConfiguration } from './types'
export const boolToText = (value: boolean): 'enabled' | 'disabled' => value ? 'enabled' : 'disabled'
export const envToBool = (env: string | undefined): boolean => Boolean(env && env.toLowerCase() !== 'false' && env !== '0')
export const canInitialize = (options: ModuleConfiguration): boolean => Boolean(options.initialize && options.dsn)
export const clientSentryEnabled = (options: ModuleConfiguration): boolean => !options.disabled && !options.disableClientSide
export const serverSentryEnabled = (options: ModuleConfiguration): boolean => !options.disabled && !options.disableServerSide
export function callOnce (fn: (...args: any[]) => any): (...args: any[]) => any {
let called = false
return function callOnceWrapper (...subargs) {
if (!called) {
called = true
return fn(...subargs)
}
}
}
================================================
FILE: test/default.test.ts
================================================
import { fileURLToPath } from 'url'
import { dirname } from 'path'
import { describe, afterAll, beforeAll, beforeEach, test, expect } from 'vitest'
import type { Browser } from 'playwright-chromium'
import sentryTestkit from 'sentry-testkit'
import { setup, url } from '@nuxtjs/module-test-utils'
import type { Nuxt } from '../src/kit-shim'
import { $$, createBrowser, loadConfig } from './utils'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const { testkit, localServer } = sentryTestkit.default()
const TEST_DSN = 'http://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001'
describe('Smoke test (default)', () => {
let nuxt: Nuxt
let browser: Browser
beforeAll(async () => {
await localServer.start(TEST_DSN)
const dsn = localServer.getDsn() ?? undefined
nuxt = (await setup(loadConfig(__dirname, 'default', { sentry: { dsn } }, { merge: true }))).nuxt
browser = await createBrowser()
})
afterAll(async () => {
if (browser) {
await browser.close()
}
await nuxt.close()
await localServer.stop()
})
beforeEach(() => {
testkit.reset()
})
test('builds and runs', async () => {
const page = await browser.newPage()
const errors: string[] = []
page.on('pageerror', (error) => {
errors.push(error.message)
})
await page.goto(url('/'))
// process.sentry is not initialized in webpack context in tests.
// expect(await $$('#server-side', page)).toBe('Works!')
expect(await $$('#client-side', page)).toBe('Works!')
expect(errors).toEqual([])
})
test('catches a server crash', async () => {
const page = await browser.newPage()
const response = await page.goto(url('/?crashOnLoad=1'))
expect(response!.status()).toBe(500)
const reports = testkit.reports()
expect(reports).toHaveLength(1)
expect(reports[0].error?.message).toContain('crashOnLoad is not defined')
})
test('catches a client crash', async () => {
const page = await browser.newPage()
await page.goto(url('/'))
expect(await $$('#client-side', page)).toBe('Works!')
await page.click('#crash-button')
const reports = testkit.reports()
expect(reports).toHaveLength(1)
expect(reports[0].error?.message).toContain('crash_me is not a function')
})
// TODO: Add tests for custom integration. Blocked by various sentry-kit bugs reported in its repo.
})
================================================
FILE: test/fixture/default/config/custom-client-integrations.js
================================================
/**
* @param {import('@nuxt/types').Context} _context
* @return {Promise<import('@sentry/types').Integration[]>}
*/
export default async function (_context) {
return []
}
================================================
FILE: test/fixture/default/nuxt.config.cjs
================================================
const SentryModule = require('../../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
build: {
terser: false,
},
render: {
resourceHints: false,
},
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
Replay: {},
},
clientConfig: {
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
},
customClientIntegrations: '~/config/custom-client-integrations.js',
tracing: true,
},
}
module.exports = config
================================================
FILE: test/fixture/default/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script>
export default {
asyncData ({ $sentry, query }) {
if (query.crashOnLoad) {
// @ts-ignore forces a crash
crashOnLoad()
}
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
}
</script>
================================================
FILE: test/fixture/lazy/config/custom-client-integrations.js
================================================
/**
* @param {import('@nuxt/types').Context} _context
* @return {Promise<import('@sentry/types').Integration[]>}
*/
export default async function (_context) {
return []
}
================================================
FILE: test/fixture/lazy/nuxt.config.cjs
================================================
const SentryModule = require('../../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
dev: false,
render: {
resourceHints: false,
},
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
lazy: true,
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
},
customClientIntegrations: '~/config/custom-client-integrations.js',
tracing: true,
},
publicRuntimeConfig: {
sentry: {
config: {
environment: 'production',
},
},
},
}
module.exports = config
================================================
FILE: test/fixture/lazy/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">Works {{ isSentryReady ? 'and is' : 'but is not' }} ready!</span>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
isSentryReady: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
const mockedSentry = this.$sentry
this.$sentryReady().then(() => {
this.isSentryReady = true
console.info('Sentry is ready')
// Verify that it doesn't crash.
mockedSentry.captureMessage('test')
})
}
},
mounted () {
this.$sentry.captureMessage('Hi!')
},
}
</script>
================================================
FILE: test/fixture/typescript/api/index.ts
================================================
import type { ServerMiddleware } from '@nuxt/types'
export default <ServerMiddleware> function serverRoute (req, res) {
// @ts-expect-error crash on purpose
apiCrash()
res.end('OK')
}
================================================
FILE: test/fixture/typescript/config/custom-client-integrations.ts
================================================
import type { Integration } from '@sentry/types'
import type { Context } from '@nuxt/types'
export default async function (_context: Context): Promise<Integration[]> {
return []
}
================================================
FILE: test/fixture/typescript/config/server.config.ts
================================================
import { ModuleOptions } from '../../../../src/types'
export default function (): ModuleOptions['serverConfig'] {
return {
beforeSend (event, _hint) {
event.extra = {
foo: '1',
}
return event
},
}
}
================================================
FILE: test/fixture/typescript/nuxt.config.ts
================================================
import { fileURLToPath } from 'node:url'
import initJiti from 'jiti'
import type { NuxtConfig } from '@nuxt/types'
const jiti = initJiti(fileURLToPath(import.meta.url))
const config: NuxtConfig = {
rootDir: __dirname,
telemetry: false,
build: {
terser: false,
},
render: {
resourceHints: false,
},
buildModules: [
'@nuxt/typescript-build',
],
modules: [
jiti.resolve('../../..'),
],
publicRuntimeConfig: {
baseURL: 'http://localhost:3000',
},
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
clientIntegrations: {
// Integration from @Sentry/browser package.
TryCatch: { eventTarget: false },
Replay: {},
Dedupe: false,
},
serverIntegrations: {
Modules: false,
},
clientConfig: {
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
// If the entire session is not sampled, use the below sample rate to sample
// sessions when an error occurs.
replaysOnErrorSampleRate: 1.0,
},
customClientIntegrations: '~/config/custom-client-integrations.ts',
serverConfig: '~/config/server.config',
tracing: true,
},
serverMiddleware: [
{ path: '/api', handler: '~/api/index' },
],
typescript: {
typeCheck: false,
},
}
export default config
================================================
FILE: test/fixture/typescript/pages/disabled-integrations.vue
================================================
<template>
<div>
<p>Integrations</p>
<p id="client">
Dedupe: {{ clientDedupeDisabled ? 'DISABLED' : 'ENABLED' }}
</p>
<p id="server">
Modules: {{ serverModulesDisabled ? 'DISABLED' : 'ENABLED' }}
</p>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
import type { BrowserClient } from '@sentry/browser'
import type { NodeClient } from '@sentry/node'
export default defineComponent({
asyncData ({ $sentry }) {
if (process.server) {
return {
serverModulesDisabled: $sentry.getClient<NodeClient>()!.getIntegrationByName('Modules') === undefined,
}
}
},
data () {
return {
clientDedupeDisabled: false,
serverModulesDisabled: false,
}
},
created () {
if (process.client) {
this.clientDedupeDisabled = this.$sentry.getClient<BrowserClient>()!.getIntegrationByName('Dedupe') === undefined
}
},
})
</script>
================================================
FILE: test/fixture/typescript/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">{{ clientSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<p>
<button id="crash-button" type="button" @click="crash_me()">
crash me
</button>
</p>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
async asyncData ({ $sentry, $config, query }) {
if (query.crashOnLoad) {
// @ts-ignore forces a crash
crashOnLoad()
} else if (query.crashOnLoadInApi) {
// Request crashes but doesn't propagate to asyncData.
await fetch(`${$config.baseURL}/api`)
}
if (process.server) {
return {
serverSentryPresent: Boolean($sentry?.captureException),
}
}
},
data () {
return {
clientSentryPresent: false,
serverSentryPresent: false,
}
},
created () {
if (process.client) {
this.clientSentryPresent = Boolean(this.$sentry?.captureException)
}
},
})
</script>
================================================
FILE: test/fixture/typescript/tsconfig.json
================================================
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": [
"@nuxt/typescript-build",
]
},
}
================================================
FILE: test/fixture/with-lazy-config/nuxt.config.cjs
================================================
const SentryModule = require('../../..')
/** @type {import('@nuxt/types').NuxtConfig} */
const config = {
rootDir: __dirname,
telemetry: false,
dev: false,
render: {
resourceHints: false,
},
modules: [
/** @type {import('@nuxt/types').Module} */(/** @type {unknown} */(SentryModule)),
],
sentry: {
dsn: 'https://fe8b7df6ea7042f69d7a97c66c2934f7@sentry.io.nuxt/1429779',
config: {},
lazy: {
mockApiMethods: [
'captureMessage',
],
injectLoadHook: true,
chunkName: 'my-chunk',
webpackPreload: true,
webpackPrefetch: true,
},
},
}
module.exports = config
================================================
FILE: test/fixture/with-lazy-config/pages/index.vue
================================================
<template>
<div>
<h3>Server-side</h3>
<span id="server-side">{{ serverSentryPresent ? 'Works!' : '$sentry object is missing!' }}</span>
<h3>Client-side</h3>
<span id="client-side">Works {{ isSentryReady ? 'and is' : 'but is not' }} ready!</span>
</div>
</template>
<script>
export default {
asyncData ({ $sentry }) {
if (process.server) {
return {
serverSentryPresent
gitextract_f2taf_wd/ ├── .editorconfig ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ ├── config.yml │ │ ├── feature_request.md │ │ └── question.md │ └── workflows/ │ ├── ci.yml │ └── size-limit.yml ├── .gitignore ├── .npmrc ├── .nvmrc ├── .release-it.cjs ├── .size-limit.cjs ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.config.ts ├── docs/ │ ├── .gitignore │ ├── .nvmrc │ ├── README.md │ ├── content/ │ │ ├── en/ │ │ │ ├── configuration/ │ │ │ │ ├── options.md │ │ │ │ └── runtime-config.md │ │ │ ├── getting-started/ │ │ │ │ └── setup.md │ │ │ ├── guide/ │ │ │ │ ├── enrich-events.md │ │ │ │ ├── lazy-loading.md │ │ │ │ ├── migration.md │ │ │ │ ├── performance.md │ │ │ │ ├── profiling.md │ │ │ │ ├── releases.md │ │ │ │ ├── session-replay.md │ │ │ │ ├── usage.md │ │ │ │ └── user-feedback.md │ │ │ └── index.md │ │ └── settings.json │ ├── nuxt.config.js │ ├── package.json │ └── patches/ │ └── @nuxtjs+tailwindcss+3.4.3.patch ├── eslint.config.mjs ├── netlify.toml ├── package.json ├── renovate.json ├── size-check/ │ ├── base/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ └── index.vue │ ├── lazy/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ └── index.vue │ ├── lazy+tracing/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ └── index.vue │ ├── package.json │ ├── replay/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ └── index.vue │ ├── tracing/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ └── index.vue │ └── typescript/ │ ├── config/ │ │ └── server.config.ts │ ├── nuxt.config.ts │ ├── pages/ │ │ └── index.vue │ └── tsconfig.json ├── src/ │ ├── hooks.ts │ ├── kit-shim.ts │ ├── module.ts │ ├── options.ts │ ├── templates/ │ │ ├── client.shared.js │ │ ├── options.ejs │ │ ├── plugin.client.js │ │ ├── plugin.lazy.js │ │ ├── plugin.mocked.js │ │ └── plugin.server.js │ ├── types/ │ │ ├── configuration.d.ts │ │ ├── extend.d.ts │ │ ├── index.d.ts │ │ └── sentry.d.ts │ └── utils.ts ├── test/ │ ├── default.test.ts │ ├── fixture/ │ │ ├── default/ │ │ │ ├── config/ │ │ │ │ └── custom-client-integrations.js │ │ │ ├── nuxt.config.cjs │ │ │ └── pages/ │ │ │ └── index.vue │ │ ├── lazy/ │ │ │ ├── config/ │ │ │ │ └── custom-client-integrations.js │ │ │ ├── nuxt.config.cjs │ │ │ └── pages/ │ │ │ └── index.vue │ │ ├── typescript/ │ │ │ ├── api/ │ │ │ │ └── index.ts │ │ │ ├── config/ │ │ │ │ ├── custom-client-integrations.ts │ │ │ │ └── server.config.ts │ │ │ ├── nuxt.config.ts │ │ │ ├── pages/ │ │ │ │ ├── disabled-integrations.vue │ │ │ │ └── index.vue │ │ │ └── tsconfig.json │ │ └── with-lazy-config/ │ │ ├── nuxt.config.cjs │ │ └── pages/ │ │ ├── index.vue │ │ └── mounted.vue │ ├── lazy.test.ts │ ├── options.test.ts │ ├── tsconfig.json │ ├── typescript.test.ts │ ├── utils.ts │ └── with-lazy-config.test.ts ├── tsconfig.json ├── types/ │ └── vuex.d.ts └── vitest.config.ts
SYMBOL INDEX (116 symbols across 22 files)
FILE: .release-it.cjs
method releaseNotes (line 13) | releaseNotes (ctx) {
FILE: size-check/typescript/config/server.config.ts
method beforeSend (line 5) | beforeSend (event, _hint) {
FILE: src/hooks.ts
constant RESOLVED_RELEASE_FILENAME (line 16) | const RESOLVED_RELEASE_FILENAME = 'sentry.release.config.mjs'
function buildHook (line 18) | async function buildHook (nuxt: Nuxt, moduleOptions: ModuleConfiguration...
function webpackConfigHook (line 65) | async function webpackConfigHook (nuxt: Nuxt, webpackConfigs: WebpackCon...
function initializeServerSentry (line 101) | async function initializeServerSentry (nuxt: Nuxt, moduleOptions: Module...
function shutdownServerSentry (line 129) | async function shutdownServerSentry (): Promise<void> {
FILE: src/kit-shim.ts
type NuxtHooks (line 13) | type NuxtHooks = Record<string, any>
type Nuxt (line 14) | interface Nuxt {
type ModuleMeta (line 28) | interface ModuleMeta {
type ModuleOptions (line 40) | type ModuleOptions = Record<string, any>
type Awaitable (line 41) | type Awaitable<T> = T | Promise<T>
type ModuleDefinition (line 43) | interface ModuleDefinition<T extends ModuleOptions = ModuleOptions> {
type NuxtModule (line 50) | interface NuxtModule<T extends ModuleOptions = ModuleOptions> {
function useNuxt (line 73) | function useNuxt (): Nuxt {
function tryUseNuxt (line 94) | function tryUseNuxt (): Nuxt | null {
constant NUXT2_SHIMS_KEY (line 99) | const NUXT2_SHIMS_KEY = '__nuxt2_shims_sentry_key__'
function nuxt2Shims (line 100) | function nuxt2Shims (nuxt: Nuxt): void {
function defineNuxtModule (line 122) | function defineNuxtModule<OptionsT extends ModuleOptions> (definition: M...
function useLogger (line 174) | function useLogger (tag?: string): typeof consola {
function isNuxt2 (line 178) | function isNuxt2 (): boolean {
type NuxtTemplate (line 182) | interface NuxtTemplate<Options = Record<string, any>> {
type ResolvedNuxtTemplate (line 196) | interface ResolvedNuxtTemplate<Options = Record<string, any>> extends Nu...
type NuxtPlugin (line 200) | interface NuxtPlugin {
type _TemplatePlugin (line 206) | type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<O...
type NuxtPluginTemplate (line 208) | interface NuxtPluginTemplate<Options = Record<string, any>> extends _Tem...
function resolveAlias (line 213) | function resolveAlias (path: string, alias?: Record<string, string>): st...
function normalizePlugin (line 223) | function normalizePlugin (plugin: NuxtPlugin | string): NuxtPlugin {
type AddPluginOptions (line 272) | interface AddPluginOptions { append?: boolean }
function addPlugin (line 273) | function addPlugin (_plugin: NuxtPlugin | string, opts: AddPluginOptions...
function addPluginTemplate (line 291) | function addPluginTemplate (plugin: NuxtPluginTemplate | string, opts: A...
function addTemplate (line 303) | function addTemplate (_template: NuxtTemplate<any> | string): ResolvedNu...
function normalizeTemplate (line 322) | function normalizeTemplate (template: NuxtTemplate<any> | string): Resol...
type ExtendConfigOptions (line 368) | interface ExtendConfigOptions {
type ExtendWebpackConfigOptions (line 395) | interface ExtendWebpackConfigOptions extends ExtendConfigOptions {}
function addWebpackPlugin (line 400) | function addWebpackPlugin (plugin: WebpackPluginInstance | WebpackPlugin...
function extendWebpackConfig (line 417) | function extendWebpackConfig (
FILE: src/module.ts
method setup (line 56) | async setup (options, nuxt) {
FILE: src/options.ts
type SentryHandlerProxy (line 19) | interface SentryHandlerProxy {
type BooleanMap (line 25) | type BooleanMap<T extends Record<string, unknown>> = Record<keyof T, true>
type IntegrationToImportMapping (line 26) | type IntegrationToImportMapping = Record<keyof AllIntegrations, string>
constant BROWSER_CORE_INTEGRATIONS (line 28) | const BROWSER_CORE_INTEGRATIONS: BooleanMap<ClientCoreIntegrations> = {
constant BROWSER_INTEGRATIONS (line 35) | const BROWSER_INTEGRATIONS: BooleanMap<BrowserIntegrations> = {
constant BROWSER_PLUGGABLE_INTEGRATIONS (line 44) | const BROWSER_PLUGGABLE_INTEGRATIONS: BooleanMap<ClientPluggableIntegrat...
constant SERVER_CORE_INTEGRATIONS (line 56) | const SERVER_CORE_INTEGRATIONS: BooleanMap<ServerCoreIntegrations> = {
constant SERVER_NODE_INTEGRATIONS (line 64) | const SERVER_NODE_INTEGRATIONS: BooleanMap<NodeIntegrations> = {
constant SERVER_PLUGGABLE_INTEGRATIONS (line 87) | const SERVER_PLUGGABLE_INTEGRATIONS: BooleanMap<ServerPluggableIntegrati...
constant INTEGRATION_TO_IMPORT_NAME_MAP (line 98) | const INTEGRATION_TO_IMPORT_NAME_MAP: IntegrationToImportMapping = {
function mapClientIntegrationToImportName (line 138) | function mapClientIntegrationToImportName (key: keyof ClientIntegrations...
function mapServerIntegrationToImportName (line 142) | function mapServerIntegrationToImportName (key: keyof ServerIntegrations...
constant SERVER_PROFILING_INTEGRATION (line 151) | const SERVER_PROFILING_INTEGRATION: keyof Pick<NodeProfilingIntegrations...
function getEnabledIntegrations (line 153) | function getEnabledIntegrations<T extends AllIntegrations> (integrations...
function getDisabledIntegrationKeys (line 157) | function getDisabledIntegrationKeys<T extends AllIntegrations> (integrat...
function getIntegrationsKeys (line 161) | function getIntegrationsKeys<T extends Partial<Record<keyof AllIntegrati...
function isBrowserCoreIntegration (line 165) | function isBrowserCoreIntegration (name: string): name is keyof ClientCo...
function isBrowserDefaultIntegration (line 169) | function isBrowserDefaultIntegration (name: string): name is keyof Brows...
function isBrowserPluggableIntegration (line 173) | function isBrowserPluggableIntegration (name: string): name is keyof Cli...
function isServerCoreIntegration (line 177) | function isServerCoreIntegration (name: string): name is keyof ServerCor...
function isServerNodeIntegration (line 181) | function isServerNodeIntegration (name: string): name is keyof NodeInteg...
function isServerPlugabbleIntegration (line 185) | function isServerPlugabbleIntegration (name: string): name is keyof Serv...
function getApiMethods (line 189) | async function getApiMethods (packageName: string): Promise<string[]> {
function resolveRelease (line 210) | async function resolveRelease (moduleOptions: Readonly<ModuleConfigurati...
function resolveClientLazyOptions (line 223) | function resolveClientLazyOptions (options: ModuleConfiguration, apiMeth...
function resolveTracingOptions (line 257) | function resolveTracingOptions (options: ModuleConfiguration): void {
type ResolvedClientOptions (line 280) | type ResolvedClientOptions = {
function resolveClientOptions (line 296) | async function resolveClientOptions (nuxt: Nuxt, moduleOptions: Readonly...
type ResolvedServerOptions (line 375) | type ResolvedServerOptions = {
function resolveServerOptions (line 383) | async function resolveServerOptions (nuxt: Nuxt, moduleOptions: Readonly...
function getServerRuntimeConfig (line 487) | function getServerRuntimeConfig (nuxt: Nuxt, options: Readonly<ModuleCon...
FILE: src/templates/client.shared.js
constant DISABLED_INTEGRATION_KEYS (line 20) | const DISABLED_INTEGRATION_KEYS = <%= serialize(options.DISABLED_INTEGRA...
FILE: src/templates/plugin.lazy.js
function SentryPlugin (line 48) | function SentryPlugin (ctx, inject) {
function loadSentry (line 99) | async function loadSentry (ctx, inject) {
function forceInject (line 167) | function forceInject (ctx, inject, key, value) {
FILE: src/templates/plugin.server.js
function connectBackendTraces (line 26) | function connectBackendTraces (ctx) {
FILE: src/types/configuration.d.ts
type LazyConfiguration (line 9) | interface LazyConfiguration {
type TracingConfiguration (line 18) | interface TracingConfiguration extends Pick<SentryOptions, 'tracesSample...
type ModuleConfiguration (line 24) | interface ModuleConfiguration {
type PartialModuleConfiguration (line 49) | type PartialModuleConfiguration = Partial<ModuleConfiguration>
FILE: src/types/extend.d.ts
type ModulePublicRuntimeConfig (line 8) | type ModulePublicRuntimeConfig = Pick<PartialModuleConfiguration, 'confi...
type Sentry (line 10) | type Sentry = typeof SentryTypes
type NodeSentry (line 11) | type NodeSentry = typeof SentryNode
type Vue (line 15) | interface Vue {
type Context (line 24) | interface Context {
type NuxtOptions (line 30) | interface NuxtOptions {
type NuxtAppOptions (line 34) | interface NuxtAppOptions {
type NuxtRuntimeConfig (line 42) | interface NuxtRuntimeConfig {
type Store (line 50) | interface Store<S> {
type Process (line 59) | interface Process {
FILE: src/types/index.d.ts
type ModuleOptions (line 4) | type ModuleOptions = PartialModuleConfiguration
FILE: src/types/sentry.d.ts
type IntegrationConfig (line 30) | type IntegrationConfig<T extends IntegrationFn> = Parameters<T>[0] | Rec...
type ClassIntegrationConfig (line 31) | type ClassIntegrationConfig<T extends IntegrationClass<Integration>> = C...
type BrowserIntegrations (line 33) | type BrowserIntegrations = {
type CoreIntegrations (line 41) | type CoreIntegrations = {
type PluggableIntegrations (line 48) | type PluggableIntegrations = {
type NodeProfilingIntegrations (line 60) | type NodeProfilingIntegrations = {
type NodeIntegrations (line 64) | type NodeIntegrations = {
type ClientCoreIntegrations (line 86) | type ClientCoreIntegrations = Pick<CoreIntegrations, 'FunctionToString' ...
type ClientPluggableIntegrations (line 87) | type ClientPluggableIntegrations = PluggableIntegrations
type ClientIntegrations (line 88) | type ClientIntegrations = ClientCoreIntegrations & ClientPluggableIntegr...
type ServerCoreIntegrations (line 90) | type ServerCoreIntegrations = CoreIntegrations
type ServerPluggableIntegrations (line 91) | type ServerPluggableIntegrations = Omit<PluggableIntegrations, 'ContextL...
type ServerIntegrations (line 92) | type ServerIntegrations = ServerCoreIntegrations & ServerPluggableIntegr...
type AllIntegrations (line 94) | type AllIntegrations = ClientIntegrations & ServerIntegrations
FILE: src/utils.ts
function callOnce (line 13) | function callOnce (fn: (...args: any[]) => any): (...args: any[]) => any {
FILE: test/default.test.ts
constant TEST_DSN (line 14) | const TEST_DSN = 'http://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001'
FILE: test/fixture/typescript/config/server.config.ts
method beforeSend (line 5) | beforeSend (event, _hint) {
FILE: test/lazy.test.ts
constant TEST_DSN (line 14) | const TEST_DSN = 'http://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001'
FILE: test/options.test.ts
constant DUMMY_LOGGER (line 9) | const DUMMY_LOGGER = useLogger('nuxt:sentry:test')
constant DUMMY_NUXT (line 10) | const DUMMY_NUXT = {
function createOptions (line 19) | async function createOptions (options: PartialModuleConfiguration): Prom...
FILE: test/typescript.test.ts
constant TEST_DSN (line 15) | const TEST_DSN = 'http://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001'
FILE: test/utils.ts
function createBrowser (line 10) | async function createBrowser (): Promise<Browser> {
function $$ (line 18) | async function $$ (selector: string, page: Page): Promise<string | null> {
function loadConfig (line 26) | function loadConfig (dir: string, fixture: string | null = null, overrid...
FILE: test/with-lazy-config.test.ts
constant TEST_DSN (line 14) | const TEST_DSN = 'http://acacaeaccacacacabcaacdacdacadaca@sentry.io/000001'
FILE: vitest.config.ts
method onConsoleLog (line 6) | onConsoleLog (log, type) {
Condensed preview — 96 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (218K chars).
[
{
"path": ".editorconfig",
"chars": 207,
"preview": "# editorconfig.org\nroot = true\n\n[*]\nindent_size = 2\nindent_style = space\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 524,
"preview": "---\nname: Bug report\nabout: Report a bug report to help us improve the module.\ntitle: ''\nlabels: bug\nassignees: ''\n\n---\n"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 173,
"preview": "blank_issues_enabled: false\ncontact_links:\n - name: Nuxt Community Discord\n url: https://discord.nuxtjs.org/\n abo"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 660,
"preview": "---\nname: Feature request\nabout: Suggest an idea or enhancement for this project.\ntitle: ''\nlabels: feature-request\nassi"
},
{
"path": ".github/ISSUE_TEMPLATE/question.md",
"chars": 437,
"preview": "---\nname: Question\nabout: Ask a question about the module.\ntitle: ''\nlabels: question\nassignees: ''\n\n---\n\n<!--\n\n **IMPOR"
},
{
"path": ".github/workflows/ci.yml",
"chars": 687,
"preview": "---\nname: CI\n\non:\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\n\njobs:\n build:\n name: Li"
},
{
"path": ".github/workflows/size-limit.yml",
"chars": 657,
"preview": "---\nname: size\n\non:\n pull_request:\n branches:\n - main\n\njobs:\n size:\n name: Size Check\n runs-on: ubuntu-lat"
},
{
"path": ".gitignore",
"chars": 417,
"preview": "# Dependencies\nnode_modules\n\n# Logs\n*.log*\n\n# Temp directories\n.temp\n.tmp\n.cache\n\n# Yarn\n**/.yarn/cache\n**/.yarn/*state*"
},
{
"path": ".npmrc",
"chars": 37,
"preview": "registry=https://registry.npmjs.org/\n"
},
{
"path": ".nvmrc",
"chars": 3,
"preview": "20\n"
},
{
"path": ".release-it.cjs",
"chars": 556,
"preview": "/* eslint-disable no-template-curly-in-string */\nmodule.exports = {\n git: {\n commitMessage: 'chore: release ${versio"
},
{
"path": ".size-limit.cjs",
"chars": 779,
"preview": "module.exports = [\n {\n name: 'fixture: base',\n path: 'size-check/base/.nuxt/dist/client/',\n gzip: false,\n b"
},
{
"path": "CHANGELOG.md",
"chars": 51227,
"preview": "\n\n## [8.0.8](https://github.com/nuxt-community/sentry-module/compare/v8.0.7...v8.0.8) (2024-09-13)\n\n\n### Bug Fixes\n\n* **"
},
{
"path": "LICENSE",
"chars": 1100,
"preview": "MIT License\n\nCopyright (c) Diederik van den Burger <diederik@webrelated.nl>\n\nPermission is hereby granted, free of charg"
},
{
"path": "README.md",
"chars": 1357,
"preview": "[](https://sentry.nuxtjs.org)\n# @nuxtjs/sentry\n\n[![npm version][npm-version-sr"
},
{
"path": "build.config.ts",
"chars": 538,
"preview": "import { defineBuildConfig } from 'unbuild'\n\nexport default defineBuildConfig({\n entries: [\n {\n builder: 'mkdis"
},
{
"path": "docs/.gitignore",
"chars": 71,
"preview": "node_modules\n*.iml\n.idea\n*.log*\n.nuxt\n.vscode\n.DS_Store\ndist\nsw.*\n.env\n"
},
{
"path": "docs/.nvmrc",
"chars": 3,
"preview": "20\n"
},
{
"path": "docs/README.md",
"chars": 452,
"preview": "# docs\n\n## Setup\n\nInstall dependencies:\n\n```bash\nyarn install\n```\n\n## Development\n\n```bash\nyarn dev\n```\n\n## Static Gener"
},
{
"path": "docs/content/en/configuration/options.md",
"chars": 16827,
"preview": "---\ntitle: Options\ndescription: 'Options can be passed to Sentry using either environment variables'\nposition: 15\ncatego"
},
{
"path": "docs/content/en/configuration/runtime-config.md",
"chars": 1358,
"preview": "---\ntitle: Runtime config\ndescription: \"Load Sentry configuration at runtime\"\nposition: 16\ncategory: Configuration\n---\n\n"
},
{
"path": "docs/content/en/getting-started/setup.md",
"chars": 2038,
"preview": "---\ntitle: Setup\ndescription: 'Setup the sentry module into Nuxt'\nposition: 10\ncategory: Getting Started\n---\n\n<alert typ"
},
{
"path": "docs/content/en/guide/enrich-events.md",
"chars": 706,
"preview": "---\ntitle: Enriching Events\ndescription: Enriching Reported Events\nposition: 21\ncategory: Guide\n---\n\nSentry SDK provides"
},
{
"path": "docs/content/en/guide/lazy-loading.md",
"chars": 2217,
"preview": "---\ntitle: Lazy-Loading\ndescription: Load Sentry module lazily on the client\nposition: 22\ncategory: Guide\n---\n\nSet `lazy"
},
{
"path": "docs/content/en/guide/migration.md",
"chars": 2472,
"preview": "---\ntitle: Migration guide\ndescription: Follow this guide to upgrade from one major version to the other.\nposition: 29\nc"
},
{
"path": "docs/content/en/guide/performance.md",
"chars": 1525,
"preview": "---\ntitle: Performance Monitoring\ndescription: Track performance metrics\nposition: 23\ncategory: Guide\n---\n\nTo automatica"
},
{
"path": "docs/content/en/guide/profiling.md",
"chars": 1274,
"preview": "---\ntitle: Profiling\ndescription: Node profiling enhances tracing by providing profiles for individual transactions\nposi"
},
{
"path": "docs/content/en/guide/releases.md",
"chars": 1334,
"preview": "---\ntitle: Releases\ndescription: Creating and publishing Releases\nposition: 24\ncategory: Guide\n---\n\n> Notifying Sentry o"
},
{
"path": "docs/content/en/guide/session-replay.md",
"chars": 1640,
"preview": "---\ntitle: Session Replay\ndescription: Record and replay user interactions that lead to an error\nposition: 24\ncategory: "
},
{
"path": "docs/content/en/guide/usage.md",
"chars": 1501,
"preview": "---\ntitle: Usage / API\ndescription: Usage of Sentry in Nuxt\nposition: 20\ncategory: Guide\n---\n\n### Automatic Capturing\n\nO"
},
{
"path": "docs/content/en/guide/user-feedback.md",
"chars": 1443,
"preview": "---\ntitle: User Feedback\ndescription: A feedback dialog for providing additional user information\nposition: 25\ncategory:"
},
{
"path": "docs/content/en/index.md",
"chars": 875,
"preview": "---\ntitle: Introduction\ndescription: 'Sentry Module for Nuxt'\nposition: 1\ncategory: ''\n---\n\n<alert type=\"info\">\n\n This "
},
{
"path": "docs/content/settings.json",
"chars": 215,
"preview": "{\n \"title\": \"Sentry module\",\n \"url\": \"https://sentry.nuxtjs.org\",\n \"logo\": {\n \"light\": \"/logo-light.svg\",\n \"dar"
},
{
"path": "docs/nuxt.config.js",
"chars": 740,
"preview": "import theme from '@nuxt/content-theme-docs'\n\nexport default theme({\n docs: {\n primaryColor: '#ae9dff',\n },\n modul"
},
{
"path": "docs/package.json",
"chars": 414,
"preview": "{\n \"name\": \"docs\",\n \"version\": \"1.0.0\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"nuxt\",\n \"build\": \"nuxt build\""
},
{
"path": "docs/patches/@nuxtjs+tailwindcss+3.4.3.patch",
"chars": 1553,
"preview": "diff --git a/node_modules/@nuxtjs/tailwindcss/lib/module.js b/node_modules/@nuxtjs/tailwindcss/lib/module.js\nindex c935c"
},
{
"path": "eslint.config.mjs",
"chars": 1610,
"preview": "import base from 'eslint-config-rchl-base'\nimport typescript from 'eslint-config-rchl-typescript'\nimport vue from 'eslin"
},
{
"path": "netlify.toml",
"chars": 144,
"preview": "# https://docs.netlify.com/configure-builds/file-based-configuration\n\n[build]\n base = \"docs\"\n command = \"yarn gener"
},
{
"path": "package.json",
"chars": 3416,
"preview": "{\n \"name\": \"@nuxtjs/sentry\",\n \"version\": \"8.0.8\",\n \"description\": \"Sentry module for Nuxt.js\",\n \"repository\": \"nuxt-"
},
{
"path": "renovate.json",
"chars": 1362,
"preview": "{\n \"extends\": [\n \"config:base\",\n \":prHourlyLimit4\",\n \":semanticCommitTypeAll(chore)\"\n ],\n \"meteor\": {\n \"e"
},
{
"path": "size-check/base/nuxt.config.cjs",
"chars": 371,
"preview": "const SentryModule = require('../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __dir"
},
{
"path": "size-check/base/pages/index.vue",
"chars": 832,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/lazy/nuxt.config.cjs",
"chars": 387,
"preview": "const SentryModule = require('../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __dir"
},
{
"path": "size-check/lazy/pages/index.vue",
"chars": 832,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/lazy+tracing/nuxt.config.cjs",
"chars": 406,
"preview": "const SentryModule = require('../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __dir"
},
{
"path": "size-check/lazy+tracing/pages/index.vue",
"chars": 832,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/package.json",
"chars": 484,
"preview": "{\n \"private\": true,\n \"scripts\": {\n \"build\": \"npm-run-all --parallel build:*\",\n \"build:base\": \"nuxt b"
},
{
"path": "size-check/replay/nuxt.config.cjs",
"chars": 514,
"preview": "const SentryModule = require('../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __dir"
},
{
"path": "size-check/replay/pages/index.vue",
"chars": 832,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/tracing/nuxt.config.cjs",
"chars": 390,
"preview": "const SentryModule = require('../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __dir"
},
{
"path": "size-check/tracing/pages/index.vue",
"chars": 832,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/typescript/config/server.config.ts",
"chars": 240,
"preview": "import type { ModuleOptions } from '../../../src/types'\n\nexport default function (): ModuleOptions['serverConfig'] {\n r"
},
{
"path": "size-check/typescript/nuxt.config.ts",
"chars": 501,
"preview": "import { fileURLToPath } from 'node:url'\nimport initJiti from 'jiti'\nimport type { NuxtConfig } from '@nuxt/types'\n\ncons"
},
{
"path": "size-check/typescript/pages/index.vue",
"chars": 996,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "size-check/typescript/tsconfig.json",
"chars": 141,
"preview": "{\n \"extends\": \"../../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\n \"@nuxt/typescript-build\""
},
{
"path": "src/hooks.ts",
"chars": 5502,
"preview": "import { fileURLToPath } from 'url'\nimport { resolve } from 'path'\nimport { defu } from 'defu'\nimport type { ConsolaInst"
},
{
"path": "src/kit-shim.ts",
"chars": 12915,
"preview": "// Shim created based on v3.2.3 of @nuxt/kit\n\nimport { existsSync } from 'node:fs'\nimport { consola } from 'consola'\nimp"
},
{
"path": "src/module.ts",
"chars": 6902,
"preview": "import { fileURLToPath } from 'node:url'\nimport { defu } from 'defu'\nimport { resolvePath } from 'mlly'\nimport type { Se"
},
{
"path": "src/options.ts",
"chars": 18052,
"preview": "import { fileURLToPath } from 'node:url'\nimport type { ConsolaInstance } from 'consola'\nimport { defu } from 'defu'\nimpo"
},
{
"path": "src/templates/client.shared.js",
"chars": 3520,
"preview": "import merge from '~lodash.mergewith'\nimport * as CoreSdk from '~@sentry/core'\nimport { captureUserFeedback, forceLoad, "
},
{
"path": "src/templates/options.ejs",
"chars": 138,
"preview": "/* eslint-disable */\n<%\nfor (const [key, value] of Object.entries(options)) {\n%>export const <%= key %> = <%= serialize("
},
{
"path": "src/templates/plugin.client.js",
"chars": 304,
"preview": "import Vue from 'vue'\nimport { getConfig, init, SentrySdk } from './sentry.client.shared'\n\n/** @type {import('@nuxt/type"
},
{
"path": "src/templates/plugin.lazy.js",
"chars": 5204,
"preview": "import Vue from 'vue'\n\n<% if (options.lazy.injectMock) { %>\nconst API_METHODS = <%= JSON.stringify(options.lazy.mockApiM"
},
{
"path": "src/templates/plugin.mocked.js",
"chars": 537,
"preview": "const apiMethods = <%= JSON.stringify(options.apiMethods)%>\n\n/** @type {import('@nuxt/types').Plugin} */\nexport default "
},
{
"path": "src/templates/plugin.server.js",
"chars": 1426,
"preview": "<% if (options.tracing) { %>\nimport { getActiveSpan, getDynamicSamplingContextFromSpan, spanToTraceHeader } from '~@sent"
},
{
"path": "src/types/configuration.d.ts",
"chars": 1930,
"preview": "import { Options as SentryOptions } from '@sentry/types'\nimport { browserTracingIntegration, vueRouterInstrumentation } "
},
{
"path": "src/types/extend.d.ts",
"chars": 1436,
"preview": "import 'vue'\nimport 'vuex'\nimport '@nuxt/types'\nimport * as SentryNode from '@sentry/node'\nimport * as SentryTypes from "
},
{
"path": "src/types/index.d.ts",
"chars": 258,
"preview": "import { PartialModuleConfiguration, ModuleConfiguration } from './configuration'\nimport { ModulePublicRuntimeConfig } f"
},
{
"path": "src/types/sentry.d.ts",
"chars": 4363,
"preview": "import { IntegrationFn, IntegrationClass, Integration } from '@sentry/types'\nimport {\n breadcrumbsIntegration,\n browse"
},
{
"path": "src/utils.ts",
"chars": 880,
"preview": "import type { ModuleConfiguration } from './types'\n\nexport const boolToText = (value: boolean): 'enabled' | 'disabled' ="
},
{
"path": "test/default.test.ts",
"chars": 2419,
"preview": "import { fileURLToPath } from 'url'\nimport { dirname } from 'path'\nimport { describe, afterAll, beforeAll, beforeEach, t"
},
{
"path": "test/fixture/default/config/custom-client-integrations.js",
"chars": 176,
"preview": "/**\n * @param {import('@nuxt/types').Context} _context\n * @return {Promise<import('@sentry/types').Integration[]>}\n */\ne"
},
{
"path": "test/fixture/default/nuxt.config.cjs",
"chars": 1055,
"preview": "const SentryModule = require('../../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __"
},
{
"path": "test/fixture/default/pages/index.vue",
"chars": 930,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "test/fixture/lazy/config/custom-client-integrations.js",
"chars": 176,
"preview": "/**\n * @param {import('@nuxt/types').Context} _context\n * @return {Promise<import('@sentry/types').Integration[]>}\n */\ne"
},
{
"path": "test/fixture/lazy/nuxt.config.cjs",
"chars": 773,
"preview": "const SentryModule = require('../../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __"
},
{
"path": "test/fixture/lazy/pages/index.vue",
"chars": 933,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "test/fixture/typescript/api/index.ts",
"chars": 191,
"preview": "import type { ServerMiddleware } from '@nuxt/types'\n\nexport default <ServerMiddleware> function serverRoute (req, res) {"
},
{
"path": "test/fixture/typescript/config/custom-client-integrations.ts",
"chars": 183,
"preview": "import type { Integration } from '@sentry/types'\nimport type { Context } from '@nuxt/types'\n\nexport default async functi"
},
{
"path": "test/fixture/typescript/config/server.config.ts",
"chars": 238,
"preview": "import { ModuleOptions } from '../../../../src/types'\n\nexport default function (): ModuleOptions['serverConfig'] {\n ret"
},
{
"path": "test/fixture/typescript/nuxt.config.ts",
"chars": 1446,
"preview": "import { fileURLToPath } from 'node:url'\nimport initJiti from 'jiti'\nimport type { NuxtConfig } from '@nuxt/types'\n\ncons"
},
{
"path": "test/fixture/typescript/pages/disabled-integrations.vue",
"chars": 939,
"preview": "<template>\n <div>\n <p>Integrations</p>\n <p id=\"client\">\n Dedupe: {{ clientDedupeDisabled ? 'DISABLED' : 'ENA"
},
{
"path": "test/fixture/typescript/pages/index.vue",
"chars": 1157,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "test/fixture/typescript/tsconfig.json",
"chars": 141,
"preview": "{\n \"extends\": \"../../tsconfig.json\",\n \"compilerOptions\": {\n \"types\": [\n \"@nuxt/typescript-build\""
},
{
"path": "test/fixture/with-lazy-config/nuxt.config.cjs",
"chars": 639,
"preview": "const SentryModule = require('../../..')\n\n/** @type {import('@nuxt/types').NuxtConfig} */\nconst config = {\n rootDir: __"
},
{
"path": "test/fixture/with-lazy-config/pages/index.vue",
"chars": 1258,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentryPresent ? 'Works!' : '$sentry obje"
},
{
"path": "test/fixture/with-lazy-config/pages/mounted.vue",
"chars": 807,
"preview": "<template>\n <div>\n <h3>Server-side</h3>\n <span id=\"server-side\">{{ serverSentry ? 'Works!' : '$sentry object is m"
},
{
"path": "test/lazy.test.ts",
"chars": 1743,
"preview": "import { fileURLToPath } from 'url'\nimport { dirname } from 'path'\nimport { describe, afterAll, beforeAll, test, expect "
},
{
"path": "test/options.test.ts",
"chars": 5797,
"preview": "import { describe, test, expect } from 'vitest'\nimport { defu } from 'defu'\nimport { PartialModuleConfiguration } from '"
},
{
"path": "test/tsconfig.json",
"chars": 139,
"preview": "{\n \"extends\": \"../tsconfig.json\",\n \"include\": [\n \"./**/*\",\n \"../types/*.ts\",\n // \"./**/.nuxt/"
},
{
"path": "test/typescript.test.ts",
"chars": 3894,
"preview": "import { fileURLToPath } from 'url'\nimport { dirname } from 'path'\nimport { describe, afterAll, beforeAll, beforeEach, t"
},
{
"path": "test/utils.ts",
"chars": 1077,
"preview": "import { fileURLToPath } from 'node:url'\nimport initJiti from 'jiti'\nimport { defu } from 'defu'\nimport { join } from 'p"
},
{
"path": "test/with-lazy-config.test.ts",
"chars": 2033,
"preview": "import { fileURLToPath } from 'url'\nimport { dirname } from 'path'\nimport { describe, afterAll, beforeAll, test, expect "
},
{
"path": "tsconfig.json",
"chars": 1043,
"preview": "{\n \"compilerOptions\": {\n \"noErrorTruncation\": true,\n \"allowJs\": true,\n \"checkJs\": true,\n \"esModuleInterop\":"
},
{
"path": "types/vuex.d.ts",
"chars": 157,
"preview": "// Workaround for broken vuex export definition: https://github.com/vuejs/vuex/issues/2213\ndeclare module 'vuex' {\n exp"
},
{
"path": "vitest.config.ts",
"chars": 216,
"preview": "import { defineConfig } from 'vitest/config'\n\nexport default defineConfig({\n test: {\n hookTimeout: 30000,\n onCons"
}
]
About this extraction
This page contains the full source code of the nuxt-community/sentry-module GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 96 files (201.2 KB), approximately 59.4k tokens, and a symbol index with 116 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.