Skip to content

fix(nuxt): Ensure order of plugins is consistent #16798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default defineNuxtModule<ModuleOptions>({
addPluginTemplate({
mode: 'client',
filename: 'sentry-client-config.mjs',
order: 0,

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

addPlugin({ src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'), mode: 'client' });
// Add the plugin which loads client integrations etc. -
// this must run after the sentry-client-config plugin has run, and the client is initialized!
addPlugin({
src: moduleDirResolver.resolve('./runtime/plugins/sentry.client'),
mode: 'client',
order: 1,
});
}

const serverConfigFile = findDefaultSdkInitFile('server', nuxt);
Expand Down
Loading