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

Unhandled exceptions from wyw-in-js crashes Next.js #268

Open
yoohahn opened this issue Oct 9, 2024 · 0 comments
Open

Unhandled exceptions from wyw-in-js crashes Next.js #268

yoohahn opened this issue Oct 9, 2024 · 0 comments
Assignees
Labels
nextjs status: waiting for maintainer These issues haven't been looked at yet by a maintainer

Comments

@yoohahn
Copy link
Contributor

yoohahn commented Oct 9, 2024

Steps to reproduce

  1. Use un-existing properties on the theme object OR At the end of your file just type any random string
  2. Save the file
  3. Kaboom

Current behavior

Crashes the dev server and it needs to restart

Expected behavior

Log error or show the Error dialog in browser.

Context

When we try to access properties on undefined the wyw-in-js transformation crashes and leaves nextjs in a hanging state. Only way to recover from it is to fix the error and restart the dev-server.

What is happening is that the parsing of the css crashes. It looks like we just assumes that the key exists and never handle that wyw-in-js throws an error here.

Wrapping build in a try catch solves it. But not sure that this is the place we should fix it.

See here for a working example.

Also found another related issues while i accidentally smashed my keyboard and saved my component. It just crashes and never recovers from the crashed state. Look here for an example.

Your environment

npx @mui/envinfo
  System:
    OS: macOS 15.0
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.1.1 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.112
    Edge: 129.0.2792.79
    Safari: 18.0

Search keywords: wyw-in-js, css

@yoohahn yoohahn added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 9, 2024
@yoohahn yoohahn changed the title NextJS crashes if Unhandled exceptions from wyw-in-js crashes NextJS Oct 9, 2024
@oliviertassinari oliviertassinari changed the title Unhandled exceptions from wyw-in-js crashes NextJS Unhandled exceptions from wyw-in-js crashes Next.js Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nextjs status: waiting for maintainer These issues haven't been looked at yet by a maintainer
Projects
None yet
Development

No branches or pull requests

3 participants