@babel/runtime dependency while consuming Zustand with Typescript
See original GitHub issueWhen importing Zustand in a typescript (node CLI) project, I’m getting this error:
Error: Cannot find module '@babel/runtime/regenerator'
Require stack:
- /Users/me/projects/project/node_modules/zustand/index.cjs.js
There seem to be an index.js
and an index.cjs.js
, with Typescript importing the latter. The index.cjs.js requires @babel/runtime. My Node version is 12.x and my tsconfig looks like this:
{
"compilerOptions": {
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
"module": "commonjs",
"target": "es2019",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
}
}
I rather not change my tsconfig or Node version, unless there is a compelling reason. Is it correct that for my case I need to install @babel/runtime
as a dependency? I would expect not to, since tsc
should probably take care of everything?
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (15 by maintainers)
Top Results From Across the Web
zustand - Bountysource
When importing Zustand in a typescript (node CLI) project, I'm getting this error: Error: Cannot find module '@babel/runtime/regenerator' Require stack: ...
Read more >TS-runtime: Runtime Type Checks for TypeScript - Morioh
A package for generating runtime type checks from TypeScript type annotations ... While you know that the returned value will be a number,...
Read more >[AskJS] What libraries do you use for your development?
It gets grey when you use a library for a UI component that might save time ... Lint Staged. TypeScript. Jest. JSDOM. Testing...
Read more >How to fix - Module not found: Can't resolve '@babel/runtime ...
Make sure you got @babel/runtime installed into your regular dependencies and not the devDependencies (leave out the --dev or the -D flag ...
Read more >What happened to Components being just a visual thing?
I really like when Components are actually just visual components. ... This makes the usage of dependency-consuming Component magical.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It might be better if you could use the ESM build
index.js
. Not sure how to configure your env. Can anyone else help here?Oh, yes. That was one my huge motivation on #403.