File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -26,10 +26,15 @@ export default defineNuxtModule<ModuleOptions>({
26
26
addPluginTemplate ( {
27
27
mode : 'client' ,
28
28
filename : 'sentry-client-config.mjs' ,
29
- getContents : ( ) =>
30
- `import "${ buildDirResolver . resolve ( `/${ clientConfigFile } ` ) } "\n` +
31
- 'import { defineNuxtPlugin } from "#imports"\n' +
32
- 'export default defineNuxtPlugin(() => {})' ,
29
+
30
+ // Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
31
+ // Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
32
+ getContents : ( ) => `
33
+ import { defineNuxtPlugin } from "#imports";
34
+
35
+ export default defineNuxtPlugin(async () => {
36
+ await import("${ buildDirResolver . resolve ( `/${ clientConfigFile } ` ) } ")
37
+ });` ,
33
38
} ) ;
34
39
35
40
addPlugin ( { src : moduleDirResolver . resolve ( './runtime/plugins/sentry.client' ) , mode : 'client' } ) ;
You can’t perform that action at this time.
0 commit comments