-
-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to ship in CJS format when my package has pure ESM package dependencies? #628
Comments
Well I had to wrap it around my head for this problem, and the solution was not using CJS format but just go with ESM. It takes too much effort to convert all child node_modules into CJS if they are indeed ESM because I gotta use some extra tools like babel or whatnot. Tried all of that and it didn't work. The annoying tsup index.ts --format esm
npm i -g ts-node
node --loader=ts-node/esm dist/index.mjs Note that you are using |
@9oelM that's one way to do it, you can also just bundle the pure esm packages if you want. |
All you need todo is install ora as a dev dep and you're good to go. Any time you see a dep that's ESM simply use |
Thanks, I wish to ship both |
index.ts:
run
tsup index.ts --format cjs,esm && node dist/index.js
and get error:Upvote & Fund
The text was updated successfully, but these errors were encountered: