Skip to content

Commit

Permalink
fix: Core build
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Sep 23, 2022
1 parent 8c63d00 commit 1e71798
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
18 changes: 11 additions & 7 deletions .vite/build.ts
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 }));
}
1 change: 0 additions & 1 deletion src/mermaid.ts
@@ -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.
Expand Down

0 comments on commit 1e71798

Please sign in to comment.