-
Notifications
You must be signed in to change notification settings - Fork 16
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
__require.resolve is not a function #90
Comments
Thanks for reporting. It seems like an issue inside You could try replacing the import mjml2html from "mjml";
import { MJMLJsonObject, MJMLParseError, MJMLParsingOptions } from "mjml-core";
import React from "react";
import ReactDOMServer from "react-dom/server";
function renderToMjml(email: React.ReactElement): string {
return ReactDOMServer.renderToStaticMarkup(email);
}
interface ConvertedHtml {
html: string;
json?: MJMLJsonObject;
errors?: MJMLParseError[];
}
export function render(
email: React.ReactElement,
options: MJMLParsingOptions = {}
): ConvertedHtml {
return mjml2html(renderToMjml(email), options);
} |
@emmclaughlin I think we should try to get rid of |
I agree. The reason we kept it originally was to make migrating from v2 to v3 easier by not changing the render function. The long term goal would definitely be to allow the user to dictate if and how to minimize their HTML on their own. |
As an added note to the previous answer, you may also have to use import mjml2html from "mjml-browser"; // This line is changed
import { MJMLJsonObject, MJMLParseError, MJMLParsingOptions } from "mjml-core";
import React from "react";
import ReactDOMServer from "react-dom/server";
function renderToMjml(email: React.ReactElement): string {
return ReactDOMServer.renderToStaticMarkup(email);
}
interface ConvertedHtml {
html: string;
json?: MJMLJsonObject;
errors?: MJMLParseError[];
}
export function render(
email: React.ReactElement,
options: MJMLParsingOptions = {}
): ConvertedHtml {
return mjml2html(renderToMjml(email), options);
} |
I am getting the following error in the console when trying to render the most basic example component
I am using the version:
@faire/mjml-react: "^3.1.1"
node: 16.14.2
vite: "^4.0.4"
The text was updated successfully, but these errors were encountered: