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

show import errors in dev #1358

Merged
merged 125 commits into from
Jan 5, 2024
Merged

show import errors in dev #1358

merged 125 commits into from
Jan 5, 2024

Conversation

nitedani
Copy link
Member

Related: #621

Show helper message in dev.

@nitedani nitedani marked this pull request as ready for review December 15, 2023 03:19
@brillout
Copy link
Member

Neat 💯

How about we wrap viteDevServer.ssrLoadModule(virtualFileIdImportUserCodeServer) instead? I guess that would catch the same exceptions?

As for production, we can catch exceptions thrown by await loadServerBuild(outDir).

We can also catch exceptions thrown by await hookFnCaller() such as React's infamous Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.. (I wrote a React patch a while ago to make debugging this React error much easier; I'll see if I can find it again and polish it.)

@nitedani
Copy link
Member Author

viteDevServer.ssrLoadModule
doesn't throw any errors

I've found no other way to catch these errors.

@brillout
Copy link
Member

brillout commented Dec 16, 2023 via email

@brillout
Copy link
Member

Notable changes:

The rest is mostly just some minor refactoring.

Let me know if you object with any of the changes, otherwise I'll merge 🎉

@nitedani
Copy link
Member Author

@brillout
Copy link
Member

I actually realized I forgot to try my changes 😅

onRuntimeError is not called, it stops here: https:/vikejs/vike/pull/1358/files#diff-7fb721f8b206cd2db4fc64bbf0c4e005aac41836d50d66133acc17b019255d1cR114

Let me have a look.

@brillout
Copy link
Member

I just had a quick look. Vike treats the error as transpilation error and thus doesn't trigger onRuntimeError(). Let me fix this.

@brillout brillout force-pushed the nitedani/warn-wrong-packages branch from 42ceebd to 6a6041b Compare January 4, 2024 17:55
@brillout brillout force-pushed the nitedani/warn-wrong-packages branch from 26daede to 2043733 Compare January 5, 2024 20:46
@brillout brillout merged commit c9aa648 into main Jan 5, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants