Skip to content
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

'manifest-route-rule' middleware already exists at '/node_modules/nuxt/dist/app/middleware/manifest-route-rule.js' #241

Open
Jonston opened this issue Nov 24, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Jonston
Copy link

Jonston commented Nov 24, 2024

Greetings. Installed your package. Everything works fine, but the console shows an error
'manifest-route-rule' middleware already exists at /node_modules/nuxt/dist/app/middleware/manifest-route-rule.js'.
I fixed it with a tweak

    router: {
        middleware: {
            override: true, // 
        },
    },

But I'm not sure if this is a good idea. Can you help me to fixed it?

@Jonston Jonston added the bug Something isn't working label Nov 24, 2024
@Jonston Jonston changed the title [Bug] Short description 'manifest-route-rule' middleware already exists at '/node_modules/nuxt/dist/app/middleware/manifest-route-rule.js' Nov 24, 2024
@manchenkoff
Copy link
Owner

Hi @Jonston, not sure how this is related to the module. I couldn't reproduce it on a fresh install. The error seems to be coming from a different place. Have you tried to investigate it?

Although it might not be related to the package, in order to let me help, I would need more details about your environment and the setup you are using and at which point you have this error. All these details are in Bug Report issue template.

@Jonston
Copy link
Author

Jonston commented Nov 24, 2024

The error occurs when following nuxt-link links. I just installed nuxt, vutify and your package.

// nuxt.config.ts
import {defineNuxtConfig} from 'nuxt/config';

export default defineNuxtConfig({
    modules: ['vuetify-nuxt-module', 'nuxt-auth-sanctum'],

    router: {
        middleware: {
            override: true, // Устанавливаем переопределение middleware
        },
    },

    vuetify: {
        moduleOptions: {
            // параметры модуля
        },
        vuetifyOptions: {
            // параметры Vuetify
        }
    },

    sanctum: {
        baseUrl: 'http://localhost:80',
        endpoints: {
            login: '/api/login',
            logout: '/api/logout',
        },
    },

    compatibilityDate: '2024-11-24'
})

package.json

{
  "name": "nuxt-app",
  "private": true,
  "type": "module",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "nuxt": "^3.14.1592",
    "nuxt-auth-sanctum": "^0.5.2",
    "vue": "latest",
    "vue-router": "latest",
    "vuetify-nuxt-module": "^0.18.3"
  }
}

login.vue

<template>
  <v-sheet class="mx-auto" width="300">
    <v-form fast-fail @submit.prevent="submit">
      <v-text-field
          v-model="email"
          :rules="rules"
          label="Email"
      ></v-text-field>

      <v-text-field
          v-model="password"
          type="password"
          :rules="rules"
          label="Password"
      ></v-text-field>

      <v-btn class="mt-2" type="submit" block>Submit</v-btn>
    </v-form>
  </v-sheet>
</template>

<script setup lang="ts">
const { login } = useSanctumAuth();

const email = ref('[email protected]');
const password = ref('password');

const rules = [
  (v: string) => !!v || 'Required',
];

const submit = async () => {
  await login({
    email: email.value,
    password: password.value,
  });
}
</script>

<style scoped>

</style>

index.vue

<script setup lang="ts">
definePageMeta({
  middleware: ['sanctum:auth'],
});

const { logout } = useSanctumAuth();
const router = useRouter();

const submit = async () => {
  await logout();

  await router.push('/login');
}
</script>

<template>
  <div>
    <h1>Home Page</h1>
    <nuxt-link to="/about">About</nuxt-link>
    <br />
    <v-btn
        @click="submit"
        color="error"
    >
      logout
    </v-btn>
  </div>
</template>

@Jonston
Copy link
Author

Jonston commented Nov 24, 2024

I found the reason that triggers this error. When there is some kind of syntax or other error in the code, this notation appears. After the error is corrected, Nax begins to reinitialize the applications. It probably caches modules somehow. This is my guess. Can you reproduce it yourself?

@manchenkoff
Copy link
Owner

I have tried it on the breeze-nuxt example but with no success. To be honest, if this error appears only when you have some error or typo in the code, it is not an issue. If there is a problem with a module when your code is correct, then it is an issue 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants