-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathvite.config.ts
More file actions
49 lines (45 loc) · 1.34 KB
/
Copy pathvite.config.ts
File metadata and controls
49 lines (45 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Configuration for storybook only!
* See build configuration in the component package folder.
*/
import { resolve as resolvePath, dirname } from 'path';
import { fileURLToPath } from 'url';
import {
unpluginIcons,
unpluginIllustrations,
unpluginSemcoreResolve,
unpluginThemeResolve,
} from '@semcore/builder/plugins';
import pluginReact from '@vitejs/plugin-react';
import { createUnplugin } from 'unplugin';
import { defineConfig } from 'vite';
const rootDir = resolvePath(dirname(fileURLToPath(import.meta.url)));
export default defineConfig({
plugins: [
pluginReact({
babel: {
plugins: ['@babel/plugin-syntax-import-assertions'],
},
}),
unpluginSemcoreResolve.vite({ rootPath: rootDir }),
unpluginThemeResolve.vite({ rootPath: rootDir }),
unpluginIcons.vite({ rootPath: rootDir }),
unpluginIllustrations.vite({ rootPath: rootDir }),
createUnplugin<{}>(() => ({
name: 'docs-components-resolver',
async resolveId(id) {
if (!id.startsWith('@components/')) return null;
const purePath = id.substring('@components/'.length);
return `${resolvePath(__dirname, 'website', 'src', 'docs-components', purePath)}.jsx`;
},
})).vite({}),
],
build: {
rollupOptions: {
external: [
'**/*.test.ts',
'**/*.test.tsx',
],
},
},
});