mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
37aaca0090
The `mermaid.core.js` build was previously a UMD build that did not have `node_modules` bundled. This was designed for users to add `mermaid` to their own apps, then bundle with Webpack/ESBuild. Hence the bundle test in `cypress/platform/bundle-test.js`. As ESBuild does not support UMD, I've switched the `mermaid.core.js` to instead use ESM, as Mermaid now requires ESM (due to d3 requiring ESM). All modern bundlers also support ESM.
21 lines
568 B
JavaScript
21 lines
568 B
JavaScript
const { esmBuild, esmCoreBuild, iifeBuild } = require('./util.cjs');
|
|
const { build } = require('esbuild');
|
|
|
|
const handler = (e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
};
|
|
const watch = process.argv.includes('--watch');
|
|
|
|
// mermaid.js
|
|
build(iifeBuild({ minify: false, watch })).catch(handler);
|
|
// mermaid.esm.mjs
|
|
build(esmBuild({ minify: false, watch })).catch(handler);
|
|
|
|
// mermaid.min.js
|
|
build(esmBuild()).catch(handler);
|
|
// mermaid.esm.min.mjs
|
|
build(iifeBuild()).catch(handler);
|
|
// mermaid.core.mjs (node_modules unbundled)
|
|
build(esmCoreBuild()).catch(handler);
|