-
Notifications
You must be signed in to change notification settings - Fork 0
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
FIX bundler parsing error should not panic #11
Conversation
I have tested your changes locally. It works for other bugs, but Deskulpt still crashes if there are duplicated const React = window.__DESKULPT__.defaultDeps.React;
const options = {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
};
function Clock() {
const [time, setTime] = React.useState(new Date().toLocaleString("en", options));
function updateTime() {
setTime(new Date().toLocaleTimeString("en", options));
}
setInterval(updateTime, 10000);
return <h3>{time}</h3>;
}
const FOO = 1;
export default FOO;
export default {
render: () => <Clock />,
}; The error message is as follows
|
This is not the same issue: this one is an internal SWC error that cannot be recovered :( |
So should we merge this pr but open a new issue about this bug? |
I opened swc-project/swc#8824 upstream. Hopefully it will get fixed there, and a simple update of dependencies will fix the issue. AFAIK this PR should not be blocked by that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes the bug that Deskulpt will crash once there is a syntax error in widget source code.
Fixes #9.
This PR attempts to emit the parsing error in a formatted way instead of panicking (which is clearly wrong). The rendered error message of the reproducer in #9 should now look like this (no color, but formatted):
I've also added a corresponding widget to
test-widgets
./cc @Xinyu-Li-123 Can you give a review and confirm if this works?