mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
fix: json import
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
parent
8a489176c3
commit
2a86ced835
@ -2,11 +2,18 @@ import { build, InlineConfig } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import jisonPlugin from './jisonPlugin.js';
|
||||
import pkg from '../package.json' assert { type: 'json' };
|
||||
import { OutputOptions } from 'vite/node_modules/rollup';
|
||||
const { dependencies } = pkg;
|
||||
const watch = process.argv.includes('--watch');
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
type OutputOptions = Exclude<
|
||||
Exclude<InlineConfig['build'], undefined>['rollupOptions'],
|
||||
undefined
|
||||
>['output'];
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
const { dependencies } = JSON.parse(
|
||||
readFileSync(resolve(__dirname, '../package.json'), { encoding: 'utf8' })
|
||||
);
|
||||
const watch = process.argv.includes('--watch');
|
||||
|
||||
interface BuildOptions {
|
||||
minify: boolean | 'esbuild';
|
||||
@ -16,7 +23,7 @@ interface BuildOptions {
|
||||
|
||||
export const getBuildConfig = ({ minify, core, watch }: BuildOptions): InlineConfig => {
|
||||
const external = ['require', 'fs', 'path'];
|
||||
let output: OutputOptions | OutputOptions[] = [
|
||||
let output: OutputOptions = [
|
||||
{
|
||||
name: 'mermaid',
|
||||
format: 'esm',
|
||||
|
@ -27,7 +27,7 @@
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
|
||||
/* Modules */
|
||||
"module": "ESNext" /* Specify what module code is generated. */,
|
||||
"module": "ES6" /* Specify what module code is generated. */,
|
||||
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
||||
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||
// "baseUrl": "./src" /* Specify the base directory to resolve non-relative module names. */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user