Skip to content

Conversation

@RobbieTheWagner
Copy link

This fixes an issue with vite where it is strict about the file extension existing.

@ljharb
Copy link
Member

ljharb commented Aug 21, 2025

No, this works around a bug in vite. The extension MUST NOT be required in commonjs requires, or else the tool is broken.

Separately, the ?. syntax doesn't work in all supported node versions.

I suggest filing an issue on vite.

@ljharb ljharb closed this Aug 21, 2025
@RobbieTheWagner
Copy link
Author

@ljharb I don't think it's a vite bug. Also, optional chaining says node 14+ and node 14 has been EOL for years. Why support versions before that?

@ljharb
Copy link
Member

ljharb commented Aug 27, 2025

If it works in node, and it doesn't work in a bundler, it is always a bug in the bundler.

We support down to node 0.4, primarily because old node versions are very useful stand-ins for the old browser versions millions of people still run.

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.

2 participants