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

Dev server don't autodiscover new routes #2046

Closed
MacFJA opened this issue Jul 31, 2021 · 5 comments · Fixed by #2198
Closed

Dev server don't autodiscover new routes #2046

MacFJA opened this issue Jul 31, 2021 · 5 comments · Fixed by #2198
Labels
p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc.

Comments

@MacFJA
Copy link
Contributor

MacFJA commented Jul 31, 2021

Describe the bug

If the dev server is running, SvelteKit don't see newly added routes, and result in 404 when navigating to them.

Reproduction

  • Create a new project (npm init svelte@next my-app + select the Skeleton project, should also be true for demo app)
  • Install the project (npm install)
  • Start the dev server (npm run dev)
  • Add a new page in src/routes (ex: src/routes/test.svelte)
  • Try to navigate to the route (with the previous example: http://localhost:3000/test)

Logs

// Server console side
09:50:09 [vite] page reload .svelte-kit/dev/generated/manifest.js

// Browser side
404
Not found: /test
Error: Not found: /test
    at render_page (file:///private/tmp/sk/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1318:11)
    at async resolve (file:///private/tmp/sk/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1663:12)
    at async respond (file:///private/tmp/sk/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1614:10)
    at async Immediate.<anonymous> (file:///private/tmp/sk/my-app/node_modules/@sveltejs/kit/dist/chunks/index.js:3458:22)

System Info

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
    Memory: 78.90 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.16.1 - /opt/local/bin/node
    Yarn: 1.22.10 - /opt/local/bin/yarn
    npm: 6.14.8 - /opt/local/bin/npm
  Browsers:
    Safari: 14.1.2
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.139
    svelte: ^3.34.0 => 3.41.0

Severity

serious, but I can work around it

Additional Information

The file .svelte-kit/dev/generated/manifest.js is correctly generated.

But SvelteKit don't seem to reload it (it is only load at here: .svelte-kit//dev/runtime/internal/start.js)

A simple workaround is to stop and restart server every times a new route is created, in DX point of view it's not ideal


Initial Discord message: https://discord.com/channels/457912077277855764/819723698415599626/870925145554952222

@yash1094
Copy link

I have been, having the same issue. I have tried to downgrade the version but to no avail.

@shadman-felicity
Copy link

Same issue.

@WillsterJohnson
Copy link

I've had a similar issue, but only when refreshing the page manually or entering the url. Links to the new page/resource seem to work as expected.

@benmccann benmccann added the p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc. label Aug 4, 2021
@CaptainCodeman
Copy link
Contributor

same here, seems to be more so for server endpoints consistently

am using Typescript in case that is the common denominator (if maybe other people don't have the issue)

@shaneturner
Copy link

Same here.

Changes to existing routes work fine, and are rendered near instantly, but if I add a new route file it isn't detected and gives a 404 error.
If I exit the dev server and reload it picks up the changes. This occurs with both the Demo and Skeleton projects.
I've search around a bit and tried adding some vite specific changes to set usePolling to true, but to no effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have SvelteKit cannot be used by a small number of people, quality of life improvements, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants