mjml
mjml copied to clipboard
Cannot read property 'map' of undefined
Describe the bug
I'm getting the error Cannot read property 'map' of undefined
I can reach the error by using the built-in validation mjml --validate ./file.mjml
To Reproduce Steps to reproduce the behavior: This is the MJML that is causing this error
<mjml>
<mj-head>
<mj-include path="./styles/custom.style.mjml" /> <------ this file is empty
</mj-head>
<mj-body>
...
</mj-body>
</mjml>
Expected behavior I don't see any map() function inside the mjml, so I would suppose the mjml would build.
MJML environment (please complete the following information):
- OS: MacOS
- MJML Version: 4.11.0
- MJML tool used: Node MJML
Can reproduce the issue when the include is not a properly formatted MJML document.
Can you show the content of <mj-include path="./styles/localdining.style.mjml" />
please ?
@iRyusa I found the solution, the issue was that the included file (custom.style.mjml) file was empty, which caused the error, I added an empty <mj-style></mj-style>
tag, which solved it.
cc @kmcb777 maybe we should catch this? It shouldn't be that hard to know if a file is empty