Closed lain-d closed 5 years ago
Hi,
https://github.com/mjmlio/mjml/issues/1387 it will be fixed soon
On 19 Nov 2018, at 21:31, Dan notifications@github.com wrote:
I had to redeploy my Node app, which automatically upgrade MJML to version 4 on my heroku server. This broke my app. I cannot run my current code. Also new code examples do not work.
Reproduction Steps:
try to run code
var mjml = require('mjml'); var template = "
Hello World " const html = mjml.mjml2html(template); produces TypeError: mjml.mjml2html is not a functionTrying to run code
import mjml2html from 'mjml'
produces error
**> import mjml2html from 'mjml' import mjml2html from 'mjml' ^^^^^^^^^
SyntaxError: Unexpected identifier**
Expected behavior:
create HTML template
Observed behavior:
Error and total app crash
MJML version: 4
How can I fix my app?
it seems doing
var mjml = require('mjml'); var template = "
Hello World " const html = mjml.default(template); works, but is this the correct usage of the library? I'm throughly confused by the non-backwards compatible update.— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi @dan2600 there have been two changes, the first when switching from mjml3 to mjml4, mjml2html is now the default export so now it's const mjml2html = require('mjml')
instead of const mjml2html = require('mjml').mjml2html
The second change is what iryusa pointed out, so you need the .default
but this will be reverted soon.
But i can confirm that for now what you're doing is the correct usage of the lib.
On the other hand it should work with import mjml2html from 'mjml'
, this problem is not related to mjml.
Closing in favor of #1387
I had to redeploy my Node app, which automatically upgrade MJML to version 4 on my heroku server. This broke my app. I cannot run my current code. Also new code examples do not work.
Reproduction Steps:
try to run code
produces TypeError: mjml.mjml2html is not a function
Trying to run code
import mjml2html from 'mjml'
produces error
**> import mjml2html from 'mjml' import mjml2html from 'mjml' ^^^^^^^^^
SyntaxError: Unexpected identifier**
Expected behavior:
create HTML template
Observed behavior:
Error and total app crash
MJML version: 4
How can I fix my app?
it seems doing
works, but is this the correct usage of the library? I'm throughly confused by the non-backwards compatible update.