Skip to content

Quality: Crash on malformed __NCC_OPTS env var in typescript loader#1313

Closed
LucciHank wants to merge 1 commit intovercel:mainfrom
LucciHank:contribai/improve/quality/crash-on-malformed-ncc-opts-env-var-in-t
Closed

Quality: Crash on malformed __NCC_OPTS env var in typescript loader#1313
LucciHank wants to merge 1 commit intovercel:mainfrom
LucciHank:contribai/improve/quality/crash-on-malformed-ncc-opts-env-var-in-t

Conversation

@LucciHank
Copy link
Copy Markdown

@LucciHank LucciHank commented Apr 2, 2026

Description

JSON.parse(process.env.__NCC_OPTS || '{}') throws SyntaxError on invalid JSON; destructuring then throws TypeError if the result is not an object (e.g. env var set to a string or number). This crashes the entire ncc process whenever TypeScript support is used.

Changes

  • src/typescript.js (modified)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Code follows the style guidelines of this project
  • Self-review of code completed
  • Changes generate no new warnings
  • Corresponding changes to documentation made (if applicable)

Severity: medium

…escript loader

JSON.parse(process.env.__NCC_OPTS || '{}') throws SyntaxError on invalid JSON; destructuring then throws TypeError if the result is not an object (e.g. env var set to a string or number). This crashes the entire ncc process whenever TypeScript support is used.

Affected files: typescript.js

Signed-off-by: Hoangg Anh <131897682+LucciHank@users.noreply.github.com>
@LucciHank LucciHank requested review from Timer and styfle as code owners April 2, 2026 04:25
@LucciHank
Copy link
Copy Markdown
Author

Auto-closed: CI checks failed

The following checks failed: lint

Closing this PR since required CI checks did not pass. Sorry for the inconvenience.

@LucciHank LucciHank closed this Apr 2, 2026
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