MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / load

Function load

packages/nuxt/src/vite/addServerConfig.ts:225–248  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

223 return null;
224 },
225 load(id: string) {
226 if (id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
227 const entryId = removeSentryQueryFromPath(id).slice(resolutionIdPrefix.length);
228
229 // Mostly useful for serverless `handler` functions
230 const reExportedFunctions =
231 id.includes(SENTRY_WRAPPED_FUNCTIONS) || id.includes(SENTRY_REEXPORTED_FUNCTIONS)
232 ? constructFunctionReExport(id, entryId)
233 : '';
234
235 return (
236 // Regular `import` of the Sentry config
237 `import ${JSON.stringify(resolvedSentryConfigPath)};\n` +
238 // Dynamic `import()` for the previous, actual entry point.
239 // `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
240 `import(${JSON.stringify(entryId)});\n` +
241 // 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()`.
242 "import 'import-in-the-middle/hook.mjs';\n" +
243 `${reExportedFunctions}\n`
244 );
245 }
246
247 return null;
248 },
249 };
250}

Callers

nothing calls this directly

Calls 3

sliceMethod · 0.80

Tested by

no test coverage detected