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
@@ -160,27 +161,30 @@ function wrapEntryWithDynamicImport(resolvedSentryConfigPath: string): InputPlug
160
161
}
161
162
162
163
if(source==='import-in-the-middle/hook.mjs'){
164
+
// 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()`.
// 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
// concat the query params to mark the file (also attaches names of exports - this is needed for serverless functions to re-export the handler)
187
+
// 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)
184
188
.concat(SENTRY_WRAPPED_ENTRY)
185
189
.concat(
186
190
exportedFunctions?.length
@@ -192,18 +196,21 @@ function wrapEntryWithDynamicImport(resolvedSentryConfigPath: string): InputPlug
192
196
},
193
197
load(id: string){
194
198
if(id.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)){
195
-
constentryId=stripQueryPart(id);
199
+
constentryId=removeSentryQueryFromPath(id);
196
200
201
+
// Mostly useful for serverless `handler` functions
// Dynamic import for the previous, actual entry point.
205
-
// import() can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
209
+
// Dynamic `import()` for the previous, actual entry point.
210
+
// `import()` can be used for any code that should be run after the hooks are registered (https://nodejs.org/api/module.html#enabling)
206
211
`import(${JSON.stringify(entryId)});\n`+
212
+
// 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