Closed as not planned
Description
Describe the bug
I am migrating my node application from cjs to mjs. When I set "moduleResolution": "node16"
in tsconfig.json
, the vite.config.ts
reports This expression is not callable. Type 'typeof import("/node_modules/@vitejs/plugin-react/dist/index")' has no call signatures.ts(2349)
.
I tried to change reactPlugin()
to reactPlugin.default()
, the error disappears but vite build failed with error TypeError: reactPlugin.default is not a function
Reproduction
Steps to reproduce
set compilerOptions.moduleResolution = 'node16' in tsconfig.json
System Info
System:
OS: macOS 13.0.1
CPU: (8) arm64 Apple M1 Pro
Memory: 44.64 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.14.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.14.0/bin/npm
Browsers:
Chrome: 109.0.5414.119
Firefox: 108.0.2
Safari: 16.1
npmPackages:
@vitejs/plugin-react: ^3.1.0 => 3.1.0
vite: ^4.1.1 => 4.1.1
Used 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.