fix: Core build

This commit is contained in:
Sidharth Vinod 2022-09-23 17:20:40 +05:30
parent 8c63d002e7
commit 1e71798467
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
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) {
// 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));
output = {
name: 'mermaid',
format: 'esm',
sourcemap: true,
entryFileNames: `[name].core.mjs`,
};
// This needs to be an array. Otherwise vite will build esm & umd with same name and overwrite esm with umd.
output = [
{
format: 'esm',
sourcemap: true,
entryFileNames: `[name].core.mjs`,
},
];
}
const config: InlineConfig = {
@ -81,5 +85,5 @@ if (watch) {
} else {
build(getBuildConfig({ minify: false }));
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
* functionality and to render the diagrams to svg code.