Skip to content

Commit 98ab803

Browse files
committed
review suggestions
1 parent 5bb1f9d commit 98ab803

File tree

5 files changed

+30
-29
lines changed

5 files changed

+30
-29
lines changed

docs/platforms/javascript/common/install/esm-without-import.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ supported:
2020
When running your application in ESM mode, you will most likely want to <PlatformLink to="/install/esm">follow the ESM instructions</PlatformLink>. However, if you want to avoid using the `--import` command line option, for example if you have no way of configuring a CLI flag, you can also follow an alternative setup that involves importing the `instrument.mjs` file directly in your application.
2121

2222
<Alert level='warning' title='Restrictions of this installation method'>
23-
This installation method has a fundamental restriction: It only supports limited performance instrumentation. Only basic `http` instrumentation will work, and no DB or framework-specific instrumentation will be available.
24-
25-
Because of this, we recommend using this only if the `--import` flag is not an option for you.
23+
This installation method has fundamental restrictions:
24+
- It only supports limited performance instrumentation.
25+
- Only basic `http` instrumentation will work.
26+
- No DB or framework-specific instrumentation will be available.
2627

28+
We recommend using this only if the `--import` flag is not an option for you.
2729
</Alert>
2830

2931
You need to create a file named `instrument.mjs` that imports and initializes Sentry:

docs/platforms/javascript/guides/nuxt/install/cli-import.mdx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
---
22
title: --import CLI flag (default)
33
sidebar_order: 1
4-
description: "Learn about using the node --import CLI flag."
4+
description: "Learn how to use the node --import CLI flag."
55
---
66

77
## Understanding the `--import` CLI Flag
88

9-
The [`--import` CLI flag](https://nodejs.org/api/cli.html#--importmodule) in Node allows you to preload modules before the application starts. This is the default
10-
way in ESM to load a module before the application starts.
9+
The [`--import` CLI flag](https://nodejs.org/api/cli.html#--importmodule) in Node is the default way in ESM to preload a module before the application starts.
1110
If you cannot use the SDK's <PlatformLink to="/install/dynamic-import/">default dynamic import behaviour</PlatformLink>, setting
1211
this flag is crucial for ensuring proper server-side initialization, as Sentry needs to be initialized before the rest of the application runs.
1312

1413
## Scenarios where `--import` does not work
1514

1615
- You're not able to add Node CLI flags or environment variables that are scoped to the function runtime
17-
- As of now, **Netlify** only supports adding scoped environment variables in the paid plan
18-
- As of now, **Vercel** does not provide an option for scoping environment variables
16+
- **Netlify** only allows scoped environment variables on its paid plans at this time
17+
- **Vercel** doesn't currently provide an option for scoping environment variables
1918

2019
If any of those points apply to you, you cannot use the `--import` flag to initialize Sentry on the server-side.
2120
Check out the guide for using <PlatformLink to="/install/top-level-import/">a top-level import</PlatformLink> or a <PlatformLink to="/install/dynamic-import/">dynamic import</PlatformLink> instead.
2221

2322
## Initializing Sentry with `--import`
2423

25-
By default, the SDK will add the Sentry server config to the build output (typically `.output/server/sentry.server.config.mjs`).
24+
By default, the SDK will add the Sentry server config to the build output (typically, `.output/server/sentry.server.config.mjs`).
2625

2726
### 1. Adding `--import` to `node` command
2827

@@ -42,7 +41,6 @@ To make things easier, add a script in the `package.json`:
4241
```json {filename:package.json}
4342
{
4443
"scripts": {
45-
"preview": "NODE_OPTIONS='--import ./server/sentry.server.config.mjs' nuxt preview",
4644
"start": "node --import ./.output/server/sentry.server.config.mjs .output/server/index.mjs"
4745
}
4846
}

docs/platforms/javascript/guides/nuxt/install/dynamic-import.mdx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ export default defineNuxtConfig({
2424
})
2525
```
2626

27-
After setting this, the Sentry Nuxt SDK adds a Rollup plugin which wraps the server entry file with a dynamic `import()`.
27+
After setting this, the Sentry Nuxt SDK adds some build-time configuration to ensure your app is wrapped with `import()`.
2828
With this, Sentry can be initialized before all other modules of the application.
2929

30-
The server entry file will look something like this:
30+
The Nuxt server entry file will look something like this:
3131

3232
```javascript {filename:.output/server/index.mjs}
33-
// Note: The file may have some imports and code related to debug IDs
33+
// Note: The file may have some imports and code, related to debug IDs
3434
Sentry.init({
3535
dsn: "..."
3636
});
@@ -44,7 +44,7 @@ Depending on your setup and which version of Nitro is used, the server-side is s
4444
The build output **must not** include a regular `import` of the Nitro runtime (e.g. `import './chunks/nitro/nitro.mjs'`).
4545
See the ([GitHub issue here](https://github.com/getsentry/sentry-javascript/issues/14514)) for more information.
4646

47-
As a temporary workaround, you can add the following overrides to your application:
47+
As a temporary workaround, you can add the following overrides in your application:
4848

4949
```json {tabTitle:npm} {filename:package.json}
5050
"overrides": {
@@ -67,16 +67,14 @@ As a temporary workaround, you can add the following overrides to your applicati
6767
}
6868
```
6969

70-
You can also check out the guide for using the <PlatformLink to="/install/cli-import">CLI flag `--import`</PlatformLink> or <PlatformLink to="/install/top-level-import/">a top-level import</PlatformLink> as this might be a better choice for you.
71-
70+
You can also check out the guide for installing the SDK with a <PlatformLink to="/install/cli-import">CLI flag `--import`</PlatformLink> or a <PlatformLink to="/install/top-level-import/">top-level import</PlatformLink>.
7271

7372
## Re-exporting serverless handler functions
7473

7574
Sentry automatically detects serverless handler functions in the build output and re-exports them from the server entry file.
7675

7776
By default, Sentry re-exports functions named `handler`, `server`, and `default` exports. This will work in most cases and no other action is required.
78-
In case your serverless function has another, custom name you can override this with `experimental_entrypointWrappedFunctions`:
79-
77+
If your serverless function has a custom name, you can override it with `experimental_entrypointWrappedFunctions`:
8078

8179
```javascript {filename: nuxt.config.ts} {7}
8280
export default defineNuxtConfig({

docs/platforms/javascript/guides/nuxt/install/top-level-import.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@ sidebar_order: 2
44
description: "Learn about how the Nuxt SDK adds a top-level import to the build output."
55
---
66

7-
## Understanding top-level `import`
7+
## Understanding Top-level `import`
88

99
Sentry needs to be initialized before the application starts.
1010
If the default way of adding an <PlatformLink to="/install/cli-import">`--import` CLI flag</PlatformLink> flag does not work for you,
11-
set up the SDK for adding a top-level `import`. This will import the Sentry server-side config at the top of the server entry file.
12-
In this scenario, Sentry is not initialized before application startup, but as early as otherwise possible.
11+
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.
12+
In this case, Sentry isn’t initialized before the app starts, but is set up as early as possible.
1313

1414
<Alert level='warning' title='Restrictions of this installation method'>
15-
This installation method has a fundamental restriction: It only supports limited performance instrumentation. Only basic `http` instrumentation will work, and no DB or framework-specific instrumentation will be available.
15+
This installation method has fundamental restrictions:
16+
- It only supports limited performance instrumentation.
17+
- Only basic `http` instrumentation will work.
18+
- No DB or framework-specific instrumentation will be available.
1619

17-
Because of this, we recommend using this only if the `--import` flag is not an option for you.
20+
We recommend using this only if the `--import` flag is not an option for you.
1821
</Alert>
1922

20-
## Initializing Sentry with a top-level `import`
23+
## Initializing Sentry With a Top-level `import`
2124

2225
Enable the top-level `import` by setting `autoInjectServerSentry`:
2326

@@ -29,11 +32,11 @@ export default defineNuxtConfig({
2932
})
3033
```
3134

32-
By default, the SDK will add the Sentry server config to the build output (typically `.output/server/sentry.server.config.mjs`).
35+
By default, the SDK will add the Sentry server config to the build output (typically, `.output/server/sentry.server.config.mjs`).
3336

34-
With the top-level `import`, the server entry file will look something like this:
37+
With the top-level `import`, the Nuxt server entry file will look something like this:
3538

3639
```javascript {filename:.output/server/index.mjs}
3740
import './sentry.server.config.mjs';
38-
// Note: The file may have some imports and code related to debug IDs
41+
// Note: The file may have some imports and code, related to debug IDs
3942
```

docs/platforms/javascript/guides/nuxt/manual-setup.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ dotenv.config();
127127

128128
#### Load Sentry config
129129

130-
Sentry can only be loaded on the server-side if it is explicitly added via `--import`.
130+
Sentry can only be loaded on the server-side by being explicitly added via `--import`.
131131

132-
Refer to the documentation of using <PlatformLink to="/install/cli-import">`--import` CLI flag</PlatformLink> for setup instructions.
132+
Check out the <PlatformLink to="/install/cli-import">`--import` CLI flag</PlatformLink> docs for setup instructions.
133133

134134
<Alert level="warning">
135135
In the beta state of the Nuxt SDK, some features may not work with certain deployment providers. Check the progress on GitHub: [Compatibility with different Deployment Platforms](https://github.com/getsentry/sentry-javascript/issues/14029)

0 commit comments

Comments
 (0)