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
How override plugins from Nuxt Layer in app? #27047
Labels
Comments
Start a new pull request in StackBlitz Codeflow. |
@lna1989 You can filter by hooks // nuxt.config.ts
export default defineNuxtConfig({
devtools: { enabled: false },
extends: ["./layer"],
+ hooks: {
+ "app:resolve"(app) {
+ app.plugins = app.plugins.filter((p) =>
+ !p.src?.includes("layer/plugins/1.testPlugin.ts")
+ );
+ },
+ },
});
|
If we implement this in future we will likely use the object-syntax to allow deduplication: export default defineNuxtPlugin({
name: 'some-plugin',
setup (nuxtApp) {
// stuff
}
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in #25825
Originally posted by lna1989 February 16, 2024
'1.testPlugin.ts' plugin in the layer connected via an auto import and '1.testPlugin.ts' in App. layers connected to app in nuxt.config.ts.
Demo: https://stackblitz.com/edit/nuxt-starter-2r7whv?file=nuxt.config.ts
./layer/plugins/1.testPlugin.ts:
./plugins/1.testPlugin.ts:
The expected result: We see one message ("App testPlugin.ts'") from the App plugin in the console.
The actual result: We see two messages ("Layer testPlugin.ts'" and "'App testPlugin.ts'") in the console from both the layers plugin and the app.
The text was updated successfully, but these errors were encountered: