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
feat(nuxt): Add Rollup plugin to wrap server entry with import() (#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)
* Adds the `sentry.server.config.ts` file as `sentry.server.config.mjs` to the `.output` directory to be able to reference this file in the node --import option.
@@ -23,7 +33,7 @@ export function addServerConfigToBuild(
// We are importing "import-in-the-middle" in the returned code of the `load()` function below
165
+
// By setting `moduleSideEffects` to `true`, the import is added to the bundle, although nothing is imported from it
166
+
// By importing "import-in-the-middle/hook.mjs", we can make sure this file is included, as not all node builders are including files imported with `module.register()`.
167
+
// Prevents the error "Failed to register ESM hook Error: Cannot find module 'import-in-the-middle/hook.mjs'"
// The enclosing `if` already checks for the suffix in `source`, but a check in `resolution.id` is needed as well to prevent multiple attachment of the suffix
// Concatenates the query params to mark the file (also attaches names of re-exports - this is needed for serverless functions to re-export the handler)
// Dynamic `import()` for the previous, actual entry point.
211
+
// `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
212
+
`import(${JSON.stringify(entryId)});\n`+
213
+
// By importing "import-in-the-middle/hook.mjs", we can make sure this file wil be included, as not all node builders are including files imported with `module.register()`.
0 commit comments