consola icon indicating copy to clipboard operation
consola copied to clipboard

Module not found in typescript react app

Open gonzalofj opened this issue 1 year ago • 1 comments

Environment

npx create-react-app --version 5.0.1

npm list consola [email protected] /Users/gferreyra/dev/consola-test.ts └── [email protected]

node --version v21.6.2

Reproduction

npx create-react-app ts-console-module --template typescript npm i consola import {} from 'consola/browser' npm run start

Describe the bug

Trying to use consola/browser module in a typescript react app, the module consola/browser is not found.

This only happens in the Typescript version of the app, in a standar javascript react app the module is correctly found.

image image

Additional context

No response

Logs

No response

gonzalofj avatar Jul 08 '24 13:07 gonzalofj

Hey there @gonzalofj , if you change the moduleResolution from node to Bundler in your tsconfig.json file, it works perfectly.

selemondev avatar Jul 22 '24 08:07 selemondev

I tested with your reproduction, and it's working fine.

Feel free to reopen this issue if you have further questions ❤️

(Also, in case you missed it, CRA is deprecated: Sunsetting Create React App)

Image Image

kricsleo avatar Mar 21 '25 06:03 kricsleo