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

Nested static routes are failing to render or redirect #160

Closed
JessicaSachs opened this issue May 16, 2020 · 1 comment
Closed

Nested static routes are failing to render or redirect #160

JessicaSachs opened this issue May 16, 2020 · 1 comment

Comments

@JessicaSachs
Copy link
Contributor

JessicaSachs commented May 16, 2020

Describe the bug

Nested static routes are no longer rendering or redirecting properly

  • Previously, navigating to /subdir/index.html would render that page and then import the proper files.
  • Currently, navigating to static routes like /subdir/index.html attempt to redirect to /index.html

If this is now the desired behavior, it is also failing to execute the redirect properly.

  1. When the user navigates to /subdir/index.html, the page served is /index.html
  2. The relative imports in /index.html are executed relative to the originally requested file... e.g. /subdir/main.js is requested instead of /main.js

Reproduction

https://github.com/JessicaSachs/vite-component-test-starter/tree/repro/vite-0.15.3

npm i
npm run dev
open http://localhost:3000/test/index.html

System Info

  • required vite version: 0.15.3
  • required Operating System: OSX
  • required Node version: v12.16.1

Logs (Optional if provided reproduction)

vite v0.15.3
  vite:resolve (node_module entry) vue -> vue/dist/vue.runtime.esm-bundler.js +0ms
[vite] Optimizable dependencies detected.
Pre-bundling them to speed up dev server page load...
  (this will be run only when your dependencies have changed)
Optimized modules:
vue

  Dev server running at:
  > Local:    http://localhost:3000/
  > Network:  http://172.16.10.52:3000/

  vite:server server ready in 874ms. +0ms
redirecting / to /index.html
  vite:hmr         /index.html imports /main.js +0ms
  vite:rewrite /index.html: no imports found. +0ms
not redirecting /main.js (has file extension)
  vite:rewrite /main.js: rewriting +167ms
  vite:rewrite     "vue" --> "/@modules/vue" +0ms
  vite:hmr         /main.js imports /@modules/vue +168ms
  vite:rewrite     "./App.vue" --> "/App.vue" +1ms
  vite:hmr         /main.js imports /App.vue +1ms
  vite:hmr ws client connected +445ms
  vite:resolve (optimized) vue -> node_modules/.vite_opt_cache/vue.js +0ms
  vite:sfc /Users/jess/projects/vite-component-test-starter/App.vue parsed in 5ms. +0ms
  vite:rewrite /App.vue: rewriting +454ms
  vite:rewrite     "vite/hmr" --> "/vite/hmr" +0ms
  vite:rewrite /@modules/vue: no imports found. +5ms
  vite:sfc /Users/jess/projects/vite-component-test-starter/App.vue parse cache hit +7ms
  vite:sfc /App.vue template compiled in 15ms. +15ms
  vite:rewrite (skipped) /App.vue?type=template +16ms
  vite:sfc /Users/jess/projects/vite-component-test-starter/App.vue parse cache hit +5ms
  vite:sfc /App.vue style compiled in 59ms +59ms
  vite:rewrite (skipped) /App.vue?type=style&index=0 +65ms
redirecting /test/index.html to /index.html
  vite:rewrite /index.html: serving from cache +5s
not redirecting /test/main.js (has file extension)
  vite:rewrite (skipped) /test/main.js +20ms
  vite:hmr ws client connected +5s
@JessicaSachs
Copy link
Contributor Author

JessicaSachs commented May 19, 2020

Nice. Just verified this works in the latest (0.15.5) and upgraded Vite Component Test Starter to use it

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant