You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The --import CLI flag makes it possible to preload a module. The server config file needs to be added with the --import flag as Sentry needs to be loaded before other modules to register a hook internally:
However, this needs extra configuration from the user-side and it makes the deployment setup more complicated (as different deployment providers have a different feature set and most don't fully support modification of the node run script).
Solution
The internally discussed idea is to wrap the server entry file with a dynamic import (import()), as this also runs the code after everything else (see here).
…13945)
Feature Issue:
#13943
Adds a Rollup plugin to wrap the server entry with `import()` to load it
after Sentry was initialized.
The plugin is not yet in use (will do this in another PR - see linked
issue above)
BREAKING CHANGE: The `--import` flag must not be added anymore. If it is
still set, the server-side will be initialized twice and this leads to
unexpected errors.
---
First merge this:
#13945
Part of this:
#13943
This PR makes it the default to include a rollup plugin that wraps the
server entry file with a dynamic import (`import()`). This is a
replacement for the node `--import` CLI flag.
If you still want to manually add the CLI flag you can use this option
in the `nuxt.config.ts` file:
```js
sentry: {
dynamicImportForServerEntry: false,
}
```
(option name is up for discussion)
…13945)
Feature Issue:
#13943
Adds a Rollup plugin to wrap the server entry with `import()` to load it
after Sentry was initialized.
The plugin is not yet in use (will do this in another PR - see linked
issue above)
Description
Problem Statement
Currently, you have to add the Sentry server config from the build output to the
--input
parameter of your node script like this:The
--import
CLI flag makes it possible to preload a module. The server config file needs to be added with the--import
flag as Sentry needs to be loaded before other modules to register a hook internally:sentry-javascript/packages/node/src/sdk/initOtel.ts
Line 68 in 86c626e
However, this needs extra configuration from the user-side and it makes the deployment setup more complicated (as different deployment providers have a different feature set and most don't fully support modification of the
node
run script).Solution
The internally discussed idea is to wrap the server entry file with a dynamic import (
import()
), as this also runs the code after everything else (see here).This would change the output from this:
to this:
Tasks
import()
feat(nuxt): Add Rollup plugin to wrap server entry withimport()
#13945--import
flag feat(nuxt): Make dynamic import() wrapping default #13958The text was updated successfully, but these errors were encountered: