-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nuxt): Use --import as the default installation method (#12070)
* feat(nuxt): Use --import as the default installation method * change to experimental_entrypointWrappedFunctions * review suggestions
- Loading branch information
Showing
5 changed files
with
88 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
docs/platforms/javascript/guides/nuxt/install/top-level-import.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
title: Top-level import | ||
sidebar_order: 2 | ||
description: "Learn about how the Nuxt SDK adds a top-level import to the build output." | ||
--- | ||
|
||
## Understanding Top-level `import` | ||
|
||
Sentry needs to be initialized before the application starts. | ||
If the default way of adding an <PlatformLink to="/install/cli-import">`--import` CLI flag</PlatformLink> flag does not work for you, | ||
set up the SDK for adding a top-level `import`. This will import the Sentry server-side config at the top of the Nuxt server entry file. | ||
In this case, Sentry isn’t initialized before the app starts, but is set up as early as possible. | ||
|
||
<Alert level='warning' title='Restrictions of this installation method'> | ||
This installation method has fundamental restrictions: | ||
- It only supports limited performance instrumentation. | ||
- Only basic `http` instrumentation will work. | ||
- No DB or framework-specific instrumentation will be available. | ||
|
||
We recommend using this only if the `--import` flag is not an option for you. | ||
</Alert> | ||
|
||
## Initializing Sentry With a Top-level `import` | ||
|
||
Enable the top-level `import` by setting `autoInjectServerSentry`: | ||
|
||
```typescript {filename:nuxt.config.ts} {3} | ||
export default defineNuxtConfig({ | ||
sentry: { | ||
autoInjectServerSentry: 'top-level-import' | ||
}, | ||
}) | ||
``` | ||
|
||
By default, the SDK will add the Sentry server config to the build output (typically, `.output/server/sentry.server.config.mjs`). | ||
|
||
With the top-level `import`, the Nuxt server entry file will look something like this: | ||
|
||
```javascript {filename:.output/server/index.mjs} | ||
import './sentry.server.config.mjs'; | ||
// Note: The file may have some imports and code, related to debug IDs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters