Skip to content
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

feat: reintroduce cjs support via bundling #98

Merged
merged 2 commits into from
Jan 26, 2022
Merged

feat: reintroduce cjs support via bundling #98

merged 2 commits into from
Jan 26, 2022

Conversation

AviVahl
Copy link
Contributor

@AviVahl AviVahl commented Jan 26, 2022

closes #97

@mikaelbr
Copy link
Owner

Cool. Checking out now.

@mikaelbr
Copy link
Owner

Would this require peer dependency of 4.0.2 or over?

@AviVahl
Copy link
Contributor Author

AviVahl commented Jan 26, 2022

peerDep of marked shouldn't change, as far as I can tell.
if anything, this made it a bit easier to use with older marked.

@AviVahl
Copy link
Contributor Author

AviVahl commented Jan 26, 2022

Oh wait, I'm pushing a tiny improvement to "exports" to match info at:
https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#nested-conditions

@mikaelbr
Copy link
Owner

You're right, thinking about it more if using 4.0.0 you can still use this and then choose the ESM edition. So works as before. Tested out locally and seems to work as expected! Was looking into and verifying the exports property aswell. Good suggestion to update it! Awaiting commit

use nested conditions to allow bundling `marked-terminal`.
it would fallback to "default", per https://nodejs.org/dist/latest-v16.x/docs/api/packages.html#nested-conditions

also added "browser" field for older bundlers not supporting "exports"
@AviVahl
Copy link
Contributor Author

AviVahl commented Jan 26, 2022

Pushed. 👍

@mikaelbr mikaelbr merged commit b711379 into mikaelbr:master Jan 26, 2022
@mikaelbr
Copy link
Owner

Thanks! Good work 🍰

@AviVahl
Copy link
Contributor Author

AviVahl commented Jan 26, 2022

@mikaelbr I forget to add "index.cjs" to the "files" field of package.json :( just checked 5.1.0 and published package doesn't include it. my bad.

@AviVahl AviVahl deleted the support-cjs-and-esm branch January 26, 2022 17:01
@mikaelbr
Copy link
Owner

Hah, dang it. I should have checked that. I packaged it up but was to lazy to check contents 🤦 I'll fix it

@mikaelbr
Copy link
Owner

Screenshot 2022-01-26 at 18 08 00

Screenshot 2022-01-26 at 18 08 40

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

Successfully merging this pull request may close these issues.

Introduce hybrid cjs/esm support?
3 participants