Questions tagged [cjs]
7 questions
1
vote
0 answers
TypeScript intellisense doesn't seem to resolve default module in CJS context
Let's say I have the following basic CJS module:
module.exports = { foo: "bar" }
For which I've configured separately following TS typing:
declare const test: { foo: string };
export default test;
Having that when I try to import this typed…

Mariusz Nowak
- 32,050
- 5
- 35
- 37
0
votes
0 answers
How to have VS Code's quick action to suggest me to convert ESM to CJS?
I would like to use ESM actually, but since I'm unable to make Jest work with ESM, my only option is to use CJS. Since occasionally my code has ESM, especially when copying from the internet (even Jest's docs occasionally have ESM code), I want VS…

Ooker
- 1,969
- 4
- 28
- 58
0
votes
1 answer
Bundled module throws 'requested module does not provide an export'
I'm currently making React UI Library.
I'm using rollup as bundler , VITE just to run dev server.
after building my app, I wanted to test if bundled files runs as expected.
So, I've tried to import the file and run it. and it throws error as below
…

Justin Seo
- 59
- 8
0
votes
0 answers
Vite to excluding external libs for an ES build, but include them for CJS build
I can export Multiple builds with vite, but they both exclude external libraries from the rollupOptions. I need
an ES build using the EXTERNAL option
but a CJS WITHOUT the EXTERNAL option, or empty array.
Is this easily achievable in a…

MrKlein
- 95
- 1
- 4
0
votes
0 answers
Including Threejs as a dependency in a library (potential cjs/es6 issue)
https://github.com/unegma/react-three-fpscontrols
I have forked a repo which isn't working for me, and am trying to get it to work as an installable module: npm install @unegma/react-three-fpscontrols
When I try to use it, I keep getting the…

timhc22
- 7,213
- 8
- 48
- 66
0
votes
0 answers
Error with the dependency of a dependency in nodejs
I have forked a repo to here:
https://github.com/unegma/react-three-fpscontrols
and am trying to convert the package to use typescript..
The error I keep getting is:
TypeError: three_1.Vector3 is not a constructor
which is occurring on this line…

timhc22
- 7,213
- 8
- 48
- 66
-4
votes
0 answers
What does the cjs module do?
I received error when execute comand npm install, error cannot found module "semver". Searching in foruns i found command npm i cjs. The comand resolve this error but i read documentation and i dont undersand what problem i resolve and how module…