fix: json import, js-base64

Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
Sidharth Vinod
2022-09-23 15:42:41 +05:30
parent 2a86ced835
commit eaa1602b1a
6 changed files with 24 additions and 23 deletions

View File

@@ -2,18 +2,15 @@ import { build, InlineConfig } from 'vite';
import { resolve } from 'path';
import { fileURLToPath } from 'url';
import jisonPlugin from './jisonPlugin.js';
import { readFileSync } from 'node:fs';
import pkg from '../package.json' assert { type: 'json' };
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 { dependencies } = pkg;
const watch = process.argv.includes('--watch');
const __dirname = fileURLToPath(new URL('.', import.meta.url));
interface BuildOptions {
minify: boolean | 'esbuild';
@@ -23,7 +20,7 @@ interface BuildOptions {
export const getBuildConfig = ({ minify, core, watch }: BuildOptions): InlineConfig => {
const external = ['require', 'fs', 'path'];
let output: OutputOptions = [
let output: OutputOptions | OutputOptions[] = [
{
name: 'mermaid',
format: 'esm',