mjmlio / mjml

MJML: the only framework that makes responsive-email easy

Home Page:https://mjml.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error message on watching templates with includes (mj-include)

Russellmd opened this issue · comments

Using the watch with templates that use also "mj-inlcude" generate an error message:

Now watching file: /workspace/mjml/1.html.mjml
Now watching file: /workspace/mjml/2.html.mjml
⏳ Building hmr-runtime.js...
/workspace/mjml/1.html.mjml - Change detected
⏳ Building 1.html...
/workspace/mjml/include/header.mjml - Change detected
/workspace/mjml/include/header.mjml - Error while rendering the file : Error: Malformed MJML. Check that your structure is correct and enclosed in <mjml> tags.
at mjml2html (/workspace/node_modules/mjml-core/lib/index.js:359:11)
at readAndCompile.compiled.errors.errors (/workspace/node_modules/mjml-cli/lib/commands/watchFiles.js:65:44)
at /workspace/node_modules/lodash/_createFlow.js:71:31
at /workspace/node_modules/mjml-cli/lib/commands/watchFiles.js:110:9
at Array.forEach (<anonymous>)
at Timeout._onTimeout (/workspace/node_modules/mjml-cli/lib/commands/watchFiles.js:107:11)
at listOnTimeout (node:internal/timers:573:17)
⏳ Building 2.html...
/workspace/mjml/1.html.mjml - Successfully compiled

However, files are compiled and seems that the generate HTML is the expected one. On generating output without "watch" option there are no error messages.

Tested with MJML 4.15.3
Sandbox to reproduce: https://codesandbox.io/p/devbox/38wzpz

I moved "include" directory outside "mjml" and I see the same error in console

Thanks a lot for the sandbox @Russellmd found out the issue ! 👍 Patch should be available next week