-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Expose named exports for ESM build #2223
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/markedjs/markedjs/Gv3eqhvsrkpvPKFwfsounN2FhTLf |
94d3b8d
to
088dcd6
Compare
Would it be a good idea to add a |
There's a pending PR for it: #1725. Maybe not a bad idea, but I'd prefer to do it in a separate PR to keep this one simpler |
Yup, makes sense. |
Thanks for the approval @UziTech! Just curious, is there anything else needed before this can be merged? |
I think this looks good. On marked we want 2 approvals for each PR so we are just waiting on someone else in the markedjs org to approve it. |
## [3.0.5](v3.0.4...v3.0.5) (2021-10-06) ### Bug Fixes * Expose named exports for ESM build ([#2223](#2223)) ([3959651](3959651))
🎉 This PR is included in version 3.0.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This update broke my website's markdown renderer. I'm getting a "marked.setOptions is not a function" error. |
it seems like this change changed lib/marked.js into an ES Module |
https://unpkg.com/marked@3.0.5/lib/marked.js It certainly doesn't look like that's what happened. |
|
@splch you should set a version on your dependencies so they don't break automatically. |
For sure, I just like using the latest for development purposes so I tend to leave them unspecified. |
Here's a fix for the issue: #2226 |
Marked version:
Tested against 3.0.4
Markdown flavor: all
Description
Currently, you can only used named exports from the CJS build. This will write them in such a way that Rollup can figure out they're exposed and should be exported in the ESM build as well.
Expectation
I should be able to do
import { parse } from 'marked';
. I expectlib/marked.esm.js
toexport
theparse
methodResult
Today I get:
That's because
lib/marked.esm.js
only has adefault
exportWhat was attempted
I tried to do
import { parse } from 'marked';
Contributor
Committer
In most cases, this should be a different person than the contributor.