Skip to content

Commit f942f76

Browse files
committed
nuxt: fix order of plugins
1 parent a10be2b commit f942f76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/nuxt/src/module.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export default defineNuxtModule<ModuleOptions>({
4242
addPluginTemplate({
4343
mode: 'client',
4444
filename: 'sentry-client-config.mjs',
45+
order: -20,
4546

4647
// Dynamic import of config file to wrap it within a Nuxt context (here: defineNuxtPlugin)
4748
// Makes it possible to call useRuntimeConfig() in the user-defined sentry config file
@@ -56,7 +57,13 @@ export default defineNuxtModule<ModuleOptions>({
5657
});`,
5758
});
5859

59-
addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });
60+
// Add the plugin which loads client integrations etc. -
61+
// this must run after the sentry-client-config plugin has run, and the client is initialized!
62+
addPlugin({
63+
src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),
64+
mode: 'client',
65+
order: -10,
66+
});
6067
}
6168

6269
const serverConfigFile = findDefaultSdkInitFile('server', nuxt);

0 commit comments

Comments
 (0)