fix: Core build

This commit is contained in:
Sidharth Vinod
2022-09-23 17:20:40 +05:30
parent 8c63d002e7
commit 1e71798467
2 changed files with 11 additions and 8 deletions

View File

@@ -36,13 +36,17 @@ export const getBuildConfig = ({ minify, core, watch }: BuildOptions): InlineCon
]; ];
if (core) { if (core) {
// Core build is used to generate file without bundled dependencies.
// This is used by downstream projects to bundle dependencies themselves.
external.push(...Object.keys(dependencies)); external.push(...Object.keys(dependencies));
output = { // This needs to be an array. Otherwise vite will build esm & umd with same name and overwrite esm with umd.
name: 'mermaid', output = [
format: 'esm', {
sourcemap: true, format: 'esm',
entryFileNames: `[name].core.mjs`, sourcemap: true,
}; entryFileNames: `[name].core.mjs`,
},
];
} }
const config: InlineConfig = { const config: InlineConfig = {
@@ -81,5 +85,5 @@ if (watch) {
} else { } else {
build(getBuildConfig({ minify: false })); build(getBuildConfig({ minify: false }));
build(getBuildConfig({ minify: 'esbuild' })); build(getBuildConfig({ minify: 'esbuild' }));
build(getBuildConfig({ minify: true, core: true })); build(getBuildConfig({ minify: false, core: true }));
} }

View File

@@ -1,4 +1,3 @@
'use strict';
/** /**
* Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid
* functionality and to render the diagrams to svg code. * functionality and to render the diagrams to svg code.