mermaid/vite.config.ts

41 lines
1.2 KiB
TypeScript
Raw Normal View History

import jison from './.vite/jisonPlugin.js';
import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js';
2023-03-11 22:27:16 +08:00
import typescript from '@rollup/plugin-typescript';
import { defaultExclude, defineConfig } from 'vitest/config';
2022-09-22 18:05:22 +08:00
export default defineConfig({
resolve: {
2023-03-11 22:27:16 +08:00
extensions: ['.js'],
2022-09-22 18:05:22 +08:00
},
2023-03-11 22:27:16 +08:00
plugins: [
jison(),
jsonSchemaPlugin(), // handles .schema.yaml JSON Schema files
2023-03-11 22:27:16 +08:00
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
typescript({ compilerOptions: { declaration: false } }),
],
2022-09-22 18:05:22 +08:00
test: {
environment: 'jsdom',
globals: true,
2022-09-26 02:18:16 +08:00
// TODO: should we move this to a mermaid-core package?
setupFiles: ['packages/mermaid/src/tests/setup.ts'],
2022-09-22 18:15:44 +08:00
coverage: {
2023-06-29 01:58:23 +08:00
provider: 'v8',
2022-09-22 18:15:44 +08:00
reporter: ['text', 'json', 'html', 'lcov'],
2023-06-17 02:24:02 +08:00
reportsDirectory: './coverage/vitest',
exclude: [...defaultExclude, './tests/**', '**/__mocks__/**', '**/generated/'],
2022-09-22 18:15:44 +08:00
},
includeSource: ['packages/*/src/**/*.{js,ts}'],
2022-09-22 18:05:22 +08:00
},
2022-10-05 19:14:05 +08: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 18:05:22 +08:00
});