diff --git a/.esbuild/esbuild.cjs b/.esbuild/esbuild.cjs
index e38951bdb..393dadcf3 100644
--- a/.esbuild/esbuild.cjs
+++ b/.esbuild/esbuild.cjs
@@ -13,8 +13,8 @@ build(iifeBuild({ minify: false, watch })).catch(handler);
build(esmBuild({ minify: false, watch })).catch(handler);
// mermaid.min.js
-build(esmBuild()).catch(handler);
-// mermaid.esm.min.mjs
build(iifeBuild()).catch(handler);
+// mermaid.esm.min.mjs
+build(esmBuild()).catch(handler);
// mermaid.core.mjs (node_modules unbundled)
build(esmCoreBuild()).catch(handler);
diff --git a/.esbuild/serve.cjs b/.esbuild/serve.cjs
index 30fff7ec0..f39491855 100644
--- a/.esbuild/serve.cjs
+++ b/.esbuild/serve.cjs
@@ -67,5 +67,10 @@ const generateHandler = (server) => {
app.use(express.static('cypress/platform'));
app.all('/mermaid.js', generateHandler(iifeServer));
app.all('/mermaid.esm.mjs', generateHandler(esmServer));
- app.listen(3000);
+
+ app.all('/e2e.js', generateHandler(iifeServer));
+ app.all('/bundle-test.js', generateHandler(iifeServer));
+ app.listen(9000, () => {
+ console.log(`Listening on http://localhost:9000`);
+ });
})();
diff --git a/.esbuild/util.cjs b/.esbuild/util.cjs
index 1d16f66d9..49b8e3d10 100644
--- a/.esbuild/util.cjs
+++ b/.esbuild/util.cjs
@@ -17,7 +17,7 @@ const buildOptions = (override = {}) => {
globalName: 'mermaid',
platform: 'browser',
tsconfig: 'tsconfig.json',
- resolveExtensions: ['.ts', '.js', '.json', '.jison'],
+ resolveExtensions: ['.ts', '.js', '.mjs', '.json', '.jison'],
external: ['require', 'fs', 'path'],
outdir: 'dist',
plugins: [jisonPlugin],
@@ -83,6 +83,9 @@ exports.iifeBuild = (override = { minify: true }) => {
return buildOptions({
entryPoints: getEntryPoints(override.minify ? '.min' : ''),
format: 'iife',
+ footer: {
+ js: 'mermaid = mermaid.default;',
+ },
...override,
});
};
diff --git a/demos/er.html b/demos/er.html
index 5bccb212e..1e5d4062d 100644
--- a/demos/er.html
+++ b/demos/er.html
@@ -23,8 +23,8 @@ ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
-
-