Closed timbrownls20 closed 2 years ago
1. import this file
browserMock.ts
import jsdom from 'jsdom';
const { JSDOM } = jsdom;
const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
(global as any).window = dom.window;
(global as any).document = dom.window.document;
(global as any).navigator = dom.window.navigator;
(global as any).DOMParser = dom.window.DOMParser;
mjml-browser
)Thanks for this. Much appreciated. We also fixed it on the Next.js side by changing the import of the component that contains easy-email. So
import { EmailTemplateDesigner } from '../EmailTemplateDesigner';
changed to
import dynamic from "next/dynamic";
import type { EmailTemplateDesigner as ComponentType } from '../EmailTemplateDesigner';
const EmailTemplateDesigner = dynamic(() =>
import('../EmailTemplateDesigner').then((lib) => lib.EmailTemplateDesigner as any),
{ ssr: false }
) as typeof ComponentType;
We are getting the below error when building with Next.js
It seems to be the mjml brower - perhaps linked to this issue
https://github.com/mjmlio/mjml/issues/2173
Seems like webpack doesn't like it - though we think that the mjml-browser is already packed.
Any ideas what the issue might be?
Many Thanks