Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

bug: cjs build doesn't work in cjs #17

Closed
roninjin10 opened this issue Apr 28, 2023 · 5 comments · Fixed by #19
Closed

bug: cjs build doesn't work in cjs #17

roninjin10 opened this issue Apr 28, 2023 · 5 comments · Fixed by #19

Comments

@roninjin10
Copy link
Sponsor Contributor

There is a cjs build but because execa is included and is a js library of type: module cjs doesn't work

@roninjin10
Copy link
Sponsor Contributor Author

sindresorhus/execa#489

@roninjin10 roninjin10 changed the title bug: execa is only for type:module bug: cjs build doesn't work in cjs Apr 28, 2023
@roninjin10
Copy link
Sponsor Contributor Author

I could fix this via building execa in a build step before tsc is ran and making execa a devDep. That's a bit hacky though. This is easy to fix with most build tools by just bundling the node module too.

@roninjin10
Copy link
Sponsor Contributor Author

Another fix I could try is using (await import('execa') instead of importing it directly which should make it work in cjs

@fubhy
Copy link
Collaborator

fubhy commented Apr 28, 2023

Good catch. I'm strictly not using CJS at this point so I missed this.

My go-to solution for this is usually dynamic imports. Want to submit a PR for that?

@fubhy
Copy link
Collaborator

fubhy commented Apr 29, 2023

@roninjin10 Can you test the latest version?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants