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

"/staff" can't be use as route path #1383

Closed
AshenBird opened this issue Apr 27, 2022 · 6 comments
Closed

"/staff" can't be use as route path #1383

AshenBird opened this issue Apr 27, 2022 · 6 comments

Comments

@AshenBird
Copy link

AshenBird commented Apr 27, 2022

Version

4.0.14

Reproduction link

github.com

Steps to reproduce

step1

install dependencies

pnpm install

step2

run dev server

pnpm run dev

step3

"/staff" path and "/bar" use same component

routes like

import { createRouter, createWebHistory} from "vue-router"
export const router = createRouter({
  history:createWebHistory(),
  routes:[{
    path:"/",
    component: ()=>import("@/pages/Foo.vue"),
    children:[
      {
        path:"staff",
        component: ()=>import("@/pages/Bar.vue")
      },
      {
        path:"bar",
        component: ()=>import("@/pages/Bar.vue")
      }
    ]
  }],
})

visit http://localhost:3000/bar

visit http://localhost:3000/staff

What is expected?

"/bar" and "/staff" show same website.

What is actually happening?

vite throw error like:

[vite] Internal server error: Failed to resolve entry for package "/staff". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "/staff". The package may have incorrect main/module/exports specified in its package.json.
@LinusBorg
Copy link
Member

Works fine for me, can't reproduce the problem you are describing.

Bildschirmfoto 2022-04-27 um 08 14 36

@AshenBird
Copy link
Author

Works fine for me, can't reproduce the problem you are describing.

Bildschirmfoto 2022-04-27 um 08 14 36

I dont't know why.

image

@AshenBird
Copy link
Author

AshenBird commented Apr 27, 2022

My env :

  • windows 10 20H2
  • node v16.14.2
  • pnpm 6.32.10

@AshenBird
Copy link
Author

It‘s weird. It work fine on another host witch run ubuntu.

@AshenBird
Copy link
Author

ok, I test it on another windows host , it's work fine. I think have some mistake with me. Thank you help.

@AshenBird
Copy link
Author

I find out. it's not router package problem. It's vite's problem. If you create node packaage at root directory , and package directory be named "staff" . You can reproduce . Thanks agin !

Works fine for me, can't reproduce the problem you are describing.

Bildschirmfoto 2022-04-27 um 08 14 36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants