-
-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
Description
Related plugins
Describe the bug
Today I bumped my vite from 6.x, and @vitejs/plugin-react-swc to 4.x.
My build is now failing due to [this line](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-
react-swc/src/index.ts#L321).
$ npm run build
...
58 export { react as default, pluginForCjs as "module.exports" };
~~~~~~~~~~~~~~~~
node_modules/@vitejs/plugin-react-swc/index.d.ts:58:61 - error TS1128: Declaration or statement expected.
58 export { react as default, pluginForCjs as "module.exports" };
~
Found 2 errors in the same file, starting at: node_modules/@vitejs/plugin-react-swc/index.d.ts:58
✓ 5421 modules transformed.
My team is using TS 5.3.3, and it's a difficult upgrade for us.
The "module.exports" syntax (string literal as export name) was introduced in TypeScript 5.5.
Was the TS 5.5+ requirement an intentional change?
Reproduction
https://github.com/k-funk/vite-plugin-react-bug1
Steps to reproduce
-
Install dependencies:
npm install
-
Run the build:
npm run build
-
You'll see these errors:
node_modules/@vitejs/plugin-react-swc/index.d.ts(58,44): error TS1003: Identifier expected. node_modules/@vitejs/plugin-react-swc/index.d.ts(58,61): error TS1128: Declaration or statement expected.
System Info
System:
OS: macOS 26.1
CPU: (16) arm64 Apple M4 Max
Memory: 1.83 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.6.0 - /Users/kfunk/.nvm/versions/node/v24.6.0/bin/node
npm: 11.5.1 - /Users/kfunk/.nvm/versions/node/v24.6.0/bin/npm
Browsers:
Chrome: 142.0.7444.162
Firefox: 144.0.2
Safari: 26.1
npmPackages:
@vitejs/plugin-react-swc: ^4.2.2 => 4.2.2
vite: ^7.2.2 => 7.2.2Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.