Skip to content

Commit

Permalink
fix(nuxt): improved plugin annotating warnings (#26193)
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Mar 11, 2024
1 parent 5369987 commit 06af1cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/nuxt/src/core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ export async function annotatePlugins (nuxt: Nuxt, plugins: NuxtPlugin[]) {
...plugin
})
} catch (e) {
logger.warn(`Could not resolve \`${plugin.src}\`.`)
const relativePluginSrc = relative(nuxt.options.rootDir, plugin.src)
if ((e as Error).message === 'Invalid plugin metadata') {
logger.warn(`Failed to parse static properties from plugin \`${relativePluginSrc}\`, falling back to non-optimized runtime meta. Learn more: https://nuxt.com/docs/guide/directory-structure/plugins#object-syntax-plugins`)
} else {
logger.warn(`Failed to parse static properties from plugin \`${relativePluginSrc}\`.`, e)
}
_plugins.push(plugin)
}
}
Expand Down

0 comments on commit 06af1cd

Please sign in to comment.