fix: json import

Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
Sidharth Vinod 2022-09-23 15:23:15 +05:30
parent 8a489176c3
commit 2a86ced835
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
2 changed files with 13 additions and 6 deletions

View File

@ -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',

View File

@ -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. */,