GrapesJS version
GrapesJS MJML version
What browser are you using?
Not applicable (it's running on a server)
Reproducible demo link
https://codesandbox.io/p/sandbox/m86rgn
Describe the bug
How to reproduce the bug?
- Init GrapeJS in headless mode
- Try to run command mjml-code-to-html
What is the expected behavior?
The html is created (and does not rely on window since we run it in headless mode).
What is the current behavior?
We have this error :
window is not defined
ReferenceError: window is not defined
at Object.moduleId [as 480] ...
If is necessary to execute some code in order to reproduce the bug, paste it here below:
const editor = grapesjs.init({
telemetry: false,
headless: true,
plugins: [usePlugin(grapesJSMJML, { useCustomTheme: false })],
projectData: {"test": "test"} as ObjectAny,
});
console.log(emailEditor.runCommand('mjml-code-to-html').html.toString());
Workaround:
We found a solution by importing global-jsdom/register, that gives a mock of window.
Code of Conduct
GrapesJS version
GrapesJS MJML version
What browser are you using?
Not applicable (it's running on a server)
Reproducible demo link
https://codesandbox.io/p/sandbox/m86rgn
Describe the bug
How to reproduce the bug?
What is the expected behavior?
The html is created (and does not rely on window since we run it in headless mode).
What is the current behavior?
We have this error :
If is necessary to execute some code in order to reproduce the bug, paste it here below:
Workaround:
We found a solution by importing global-jsdom/register, that gives a mock of window.
Code of Conduct