Skip to content

Conversation

harlan-zw
Copy link
Collaborator

πŸ”— Linked issue

#481

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add null/undefined checks to prevent 500 errors in Nuxt 4 when DevTools tries to access _scripts that may not exist.

  • Add null safety check in syncScripts function to handle undefined _scripts
  • Add fallback empty object when calling syncScripts with potentially undefined _scripts
  • Fixes DevTools 500 error when _scripts is undefined in Nuxt 4 setups

Add null/undefined checks to prevent 500 errors in Nuxt 4 when DevTools tries to access _scripts that may not exist.

- Add null safety check in syncScripts function to handle undefined _scripts
- Add fallback empty object when calling syncScripts with potentially undefined _scripts
- Fixes DevTools 500 error when _scripts is undefined in Nuxt 4 setups

Resolves #481

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

vercel bot commented Sep 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
scripts-docs Ready Ready Preview Comment Sep 18, 2025 0:08am
scripts-playground Ready Ready Preview Comment Sep 18, 2025 0:08am

Copy link

pkg-pr-new bot commented Sep 18, 2025

Open in StackBlitz

npm i https://pkg.pr.new/nuxt/scripts/@nuxt/scripts@501

commit: b918064

@harlan-zw harlan-zw changed the title fix: add null safety to DevTools syncScripts function fix(devtools): add null safety Sep 22, 2025
@harlan-zw harlan-zw marked this pull request as ready for review September 22, 2025 01:33
@harlan-zw harlan-zw merged commit 31cd208 into main Sep 22, 2025
9 checks passed
@harlan-zw harlan-zw deleted the issue-481-devtools-500-error-fix branch September 22, 2025 03:05
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.

1 participant