Skip to content

Conversation

sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 29, 2025

Description

These checks existed from the first implementation (vitejs/vite#10239), but I think these are not necessary.

This improved the window reload perf a bit. (on the other hand, using import * as currentExports from 'id' instead of RefreshRuntime.__hmr_import(import.meta.url) degraded the perf, so I'm leaving that as full-bundle mode only)

@sapphi-red sapphi-red added the p2-nice-to-have 🍰 Not breaking anything but nice to have (priority) label Aug 29, 2025

function predicateOnExport(ignoredExports, moduleExports, predicate) {
for (const key in moduleExports) {
if (key === '__esModule') continue
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since moduleExports is a module namespace, the __esModule marker won't exist. If you have export const __esModule = something, it should be checked.

Comment on lines -658 to -659
const desc = Object.getOwnPropertyDescriptor(moduleExports, key)
if (desc && desc.get) return key
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since moduleExports is a module namespace, all properties are not a sideeffectful getter.

@sapphi-red sapphi-red merged commit 508bed6 into main Aug 29, 2025
13 checks passed
@sapphi-red sapphi-red deleted the perf/remove-unnecessary-export-checks branch August 29, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants