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
Native ESM Support (no new build dependencies required) #152
Comments
Thank you, that is interesting. So you're saying I can just add those lines to the top and bottom of the |
You'd have to create a separate If you want to support importing the individual functions too you'd need to explicitly export those: export const parse = exports.parse;
export const serialize = exports.serialize; The consumer would then be able to use I believe there's also a config you'd need to add to the |
@PaulKiddle You seem to already have a good handle on how this could be implemented. Would you be interested in creating a PR? |
Yep, if you're happy to go down this route I'll set up a PR when I get some free time |
Hi thanks for this great project.
I know this has been discussed a couple of times before but not resolved. I'm using Rollup for my project and
cookie
is currently the only dependency that doesn't have ESM support, meaning I have to install the CJS plugin just for this package. It's fine, but ideally I'd like to simplify my build process even more by removing it.I'm aware one of the reasons for not adding ESM support is that you don't want to add any build dependencies, which is fair enough. But there is a very simple way to add ESM support to this package just by concatenating extra lines at the start and end, which would require no build steps.
Since the only CJS-specific feature you're using is assigning properties to the
exports
object, basic ESM support would require creating a file like this:This is easy enough to create using a common shell command like
cat
.The text was updated successfully, but these errors were encountered: