Faire / mjml-react

React component library to generate the HTML emails on the fly
https://www.npmjs.com/package/@faire/mjml-react
MIT License
387 stars 17 forks source link

better expose render methods #64

Closed rolznz closed 1 year ago

rolznz commented 1 year ago

Unlike the example in the README, I have to import directly from the source:

import { render } from "@faire/mjml-react/dist/src/utils/render";

from maintainers

Ideally the goal would be:

import { render } from "@faire/mjml-react/renders";

Two blockers:

emmclaughlin commented 1 year ago

Thank you for pointing this out @rolznz! This change was made intentionally so that users who don't want to use this render import don't need to install its dependencies, but we hadn't updated to reflect this in the READEME. This PR should address it: https://github.com/Faire/mjml-react/pull/65

rolznz commented 1 year ago

@emmclaughlin I looked at the PR. Isn't there another way you can expose the import without having to import from the dist directory? this seems wrong to me.

emmclaughlin commented 1 year ago

We need to keep the render function out of the main index.ts file in order to fix dependency issues (e.g. https://github.com/Faire/mjml-react/issues/36). That said, agree it feels odd with the dist directory, will see if we can clean that up

IanEdington commented 1 year ago

If anyone has ideas of how to make this better for both esm and cjs we'd love to get help with this.

IanEdington commented 1 year ago

I think we can close this ticket and explore exporting to both esm and cjs in #72