Vite transforms object literal { property: null } to { property }
Issue Description
Using null for property values isn't working correctly.
Input:
const service = { scanner: "sample", data: null }
Compiles to:
const service = { scanner: "sample", data }
ReferenceError: data is not defined
For now, these workarounds are functional:
const NULL_VALUE = null const service = { scanner: "sample", data: NULL_VALUE } const data = null const service = { scanner: "sample", data }
Reproduction
No response
Relevant log output (if applicable)
Environment
OS: macOS 26.5 CPU: (10) arm64 Apple M4 Shell: /bin/zsh node: 25.6.1 npm: 11.9.0 nativescript: Not Found (cli version 9.0.5) # android java: 17.0.18 ndk: Not Found apis: Not Found build_tools: Not Found system_images: Not Found # ios xcode: /undefined cocoapods: Not Found python: 3.14.4 python3: 3.14.4 ruby: 3.3.11 platforms: Not Found
Dependencies
"dependencies": { "@nativescript-community/ui-label": "^1.3.42", "@nativescript/camera": "^7.0.0", "@nativescript/core": "~9.0.18", "@triniwiz/nativescript-image-cache-it": "^8.0.1", "@valor/nativescript-websockets": "^2.0.3", "nativescript-vue": "3.0.2", "nativescript-zeroconf": "file:./custom_modules/nativescript-zeroconf", "pinia": "^3.0.4", "radash": "^12.1.1", "uuidv7": "^1.2.1" }, "devDependencies": { "@maikolib/vite-plugin-yaml": "^1.1.1-0", "@nativescript/android": "^9.0.3", "@nativescript/ios": "~9.0.3", "@nativescript/tailwind": "^2.1.1", "@nativescript/types": "~9.0.0", "@nativescript/vite": "2.0.3", "@types/node": "^22.19.17", "concurrently": "^9.2.1", "nativescript": "~9.0.5", "patch-package": "^8.0.1", "tailwindcss": "~3.4.19", "typescript": "~5.9.3", "wait-on": "^7.2.0" }
Please accept these terms
- I have searched the existing issues as well as StackOverflow and this has not been posted before
- This is a bug report
- I agree to follow this project's Code of Conduct