mermaid/vite.config.ts

41 lines
1.2 KiB
TypeScript
Raw Permalink Normal View History

import jison from './.vite/jisonPlugin.js';
import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js';
2023-03-11 15:27:16 +01:00
import typescript from '@rollup/plugin-typescript';
import { defaultExclude, defineConfig } from 'vitest/config';
2022-09-22 12:05:22 +02:00
export default defineConfig({
resolve: {
2023-03-11 15:27:16 +01:00
extensions: ['.js'],
2022-09-22 12:05:22 +02:00
},
2023-03-11 15:27:16 +01:00
plugins: [
jison(),
jsonSchemaPlugin(), // handles .schema.yaml JSON Schema files
2023-03-11 15:27:16 +01:00
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
typescript({ compilerOptions: { declaration: false } }),
],
2022-09-22 12:05:22 +02:00
test: {
environment: 'jsdom',
globals: true,
2022-09-25 20:18:16 +02:00
// TODO: should we move this to a mermaid-core package?
setupFiles: ['packages/mermaid/src/tests/setup.ts'],
2022-09-22 12:15:44 +02:00
coverage: {
2023-06-28 19:58:23 +02:00
provider: 'v8',
2022-09-22 12:15:44 +02:00
reporter: ['text', 'json', 'html', 'lcov'],
2023-06-16 20:24:02 +02:00
reportsDirectory: './coverage/vitest',
exclude: [...defaultExclude, './tests/**', '**/__mocks__/**', '**/generated/'],
2022-09-22 12:15:44 +02:00
},
includeSource: ['packages/*/src/**/*.{js,ts}'],
2022-09-22 12:05:22 +02:00
},
2022-10-05 13:14:05 +02:00
build: {
/** If you set esmExternals to true, this plugins assumes that
all external dependencies are ES modules */
commonjsOptions: {
esmExternals: true,
},
},
define: {
'import.meta.vitest': 'undefined',
},
2022-09-22 12:05:22 +02:00
});