-
-
Notifications
You must be signed in to change notification settings - Fork 237
Could not find a declaration file for module '@babel/core'. #211
Description
Describe the bug
When using @vitejs/plugin-react@4.0.4, I get this error when building my application:

I can get rid of this error by installing @types/babel__core, but I don't think it should be the user's responsibility to install a type on which a dependency depends.
Reproduction
https://github.com/saramorillon/inventory/tree/b612b372734dda6454872427a76b037050d50ed9
Steps to reproduce
In front directory, run yarn install followed by yarn build
System Info
System:
OS: Windows 10 10.0.22621
CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
Memory: 6.41 GB / 15.93 GB
Binaries:
Node: 19.1.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.19.3 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 116.0.5845.96
Edge: Spartan (44.22621.2134.0), Chromium (115.0.1901.203)
Internet Explorer: 11.0.22621.1
npmPackages:
@vitejs/plugin-react: ^4.0.4 => 4.0.4
vite: ^4.4.9 => 4.4.9Used Package Manager
yarn
Logs
node_modules/@vitejs/plugin-react/dist/index.d.ts:1:49 - error TS7016: Could not find a declaration file for module '@babel/core'. '/node_modules/@babel/core/lib/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/babel__core if it exists or add a new declaration (.d.ts) file containing declare module '@babel/core';
1 import { TransformOptions, ParserOptions } from '@babel/core';
~~~~~~~~~~~~~
Found 1 error.
error Command failed with exit code 1.
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.