mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +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 { resolve } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import jisonPlugin from './jisonPlugin.js';
|
import jisonPlugin from './jisonPlugin.js';
|
||||||
import pkg from '../package.json' assert { type: 'json' };
|
import { readFileSync } from 'node:fs';
|
||||||
import { OutputOptions } from 'vite/node_modules/rollup';
|
|
||||||
const { dependencies } = pkg;
|
type OutputOptions = Exclude<
|
||||||
const watch = process.argv.includes('--watch');
|
Exclude<InlineConfig['build'], undefined>['rollupOptions'],
|
||||||
|
undefined
|
||||||
|
>['output'];
|
||||||
|
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
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 {
|
interface BuildOptions {
|
||||||
minify: boolean | 'esbuild';
|
minify: boolean | 'esbuild';
|
||||||
@ -16,7 +23,7 @@ interface BuildOptions {
|
|||||||
|
|
||||||
export const getBuildConfig = ({ minify, core, watch }: BuildOptions): InlineConfig => {
|
export const getBuildConfig = ({ minify, core, watch }: BuildOptions): InlineConfig => {
|
||||||
const external = ['require', 'fs', 'path'];
|
const external = ['require', 'fs', 'path'];
|
||||||
let output: OutputOptions | OutputOptions[] = [
|
let output: OutputOptions = [
|
||||||
{
|
{
|
||||||
name: 'mermaid',
|
name: 'mermaid',
|
||||||
format: 'esm',
|
format: 'esm',
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
|
||||||
/* Modules */
|
/* 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. */,
|
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
||||||
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
"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. */,
|
// "baseUrl": "./src" /* Specify the base directory to resolve non-relative module names. */,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user