require('mjml') is no longer exporting mjml2html as default method
See original GitHub issueWhen importing mjml as a node module the method mjml2html
is no longer available as default export. This problem occurs since the 4.2 release.
Steps to reproduce the behavior:
- Import mjml in a node project using
require('mjml')
- Convert a template String by calling
mjml(templateString, cfg)
- Error message
mjml is not a function
Expected behavior The given mjml templateString is converted to html.
MJML environment (please complete the following information):
- Node 10.11, npm 6.4.1
- MJML V4.2.0
The new export for handleMjmlConfig seems to be causing this problem: https://github.com/mjmlio/mjml/blob/master/packages/mjml/src/index.js#L49-L51
A workaround to fix this issue on the user’s side is explicitly importing the default property: require('mjml').default
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:13 (7 by maintainers)
Top Results From Across the Web
mjml-guides – Documentation for MJML - The Responsive ...
The default behavior of the MJML translation engine is to divide the section space (600px by default, but it can be changed with...
Read more >Mjml NPM - npm.io
MJML is a markup language created by Mailjet and designed to reduce the pain of coding a responsive email. Its semantic syntax makes...
Read more >Mjml Editor - StackBlitz
import mjml from './sample.js';. export default function App() {. let [code, setCode] = useState(mjml);. let [mobile, setMobile] = useState(true);.
Read more >mjml - npm
Installation. You can install MJML with NPM to use it with NodeJS or the Command Line Interface. If you're not sure what ...
Read more >mjml-master-pathable - npm Package Health Analysis - Snyk
Learn more about mjml-master-pathable: package health score, ... You can pass optional options as an object to the mjml2html function: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m not sure how this is fixed. At least in TypeScript, I cannot do either of these:
The only way to make this work is:
Which is… undesirable. What is the plan for this?
We’ve discussed a bit and it was used in mjml-app, so we might need to check that it works fine with the app first