Skip to content

Could not find a declaration file for module '@babel/core'. #211

@saramorillon

Description

@saramorillon

Describe the bug

When using @vitejs/plugin-react@4.0.4, I get this error when building my application:
image

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.9

Used 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions