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

Avoid crashing dev server on file rename #119

Open
shiro opened this issue Jan 12, 2024 · 9 comments
Open

Avoid crashing dev server on file rename #119

shiro opened this issue Jan 12, 2024 · 9 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@shiro
Copy link

shiro commented Jan 12, 2024

There's currently lot's of ways to crash the dev server, could we add a global error handler so this doesn't happen?

When renaming a file, the error message looks something like:

12:08:20 AM [vite] Error when evaluating SSR module /packages/client/Something.tsx: failed to import "/packages/client/RenamedFile.tsx"
|- Error: Failed to load url /packages/client/RenamedFile.tsx (resolved id: /packages/client/RenamedFile) in /opt/app/web/packages/client/Something.tsx. Does the file exist?
at loadAndTransform (file:///opt/app/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55015:21)

node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
@nksaraf nksaraf added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Jan 14, 2024
@nksaraf
Copy link
Owner

nksaraf commented Jan 14, 2024

Yuppp! wanting to do that. You want to make a PR for this?

@shiro
Copy link
Author

shiro commented Jan 14, 2024

Not right now, if someone wants to make a PR, feel free to do so 👍

@BierDav
Copy link

BierDav commented Mar 19, 2024

Please can someone fix that, this is really really annoying

@nksaraf
Copy link
Owner

nksaraf commented Mar 19, 2024

give a reproducible repo please so i can test this and possibly fix it. i dont see this happen

@BierDav
Copy link

BierDav commented Mar 19, 2024

It is quite simple, just import a module that doesn't exist, the server instantly crashes

@LukasGerm
Copy link

ill try to find a good way around it and create a PR

@LukasGerm
Copy link

So what would be the expected behavior? I just tested it real quick and I just get a normal error overlay and once I remove the line, which is breaking, it refreshs and good to go again.

@shiro
Copy link
Author

shiro commented May 22, 2024

So what would be the expected behavior? I just tested it real quick and I just get a normal error overlay and once I remove the line, which is breaking, it refreshs and good to go again.

(At least with Solid Start) it really depends on what the error is, some of them just show the error overlay and go away when fixed, others still crash the server.

Here's some ways to crash it with a fresh Solid Start Basic template:

routes/index.tsx

import { Title } from "@solidjs/meta";
-import Counter from "~/components/Counter";
+import Counter from "~/components/Counte";

I think this always crashes it when there's a valid import and it becomes invalid while the dev server is running.

entry-server.tsx

        <head>
          <meta charset="utf-8" />
          <meta name="viewport" content="width=device-width, initial-scale=1" />
          <link rel="icon" href="/favicon.ico" />
-          {assets}
+          {foo}
        </head>

No idea why this one crashed it, but just putting some gibberish in the global scope does not. I guess it's due to some SSR thing not handling errors inside the tree.

@LukasGerm
Copy link

LukasGerm commented May 22, 2024

So after investigating a bit, I dont really see how we can prevent this issue on our side, I assume it could be fixed on vinxi side. I will try to look into their codebase.

Edit: Hm, cannot reproduce in their playground, ill doublecheck again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants