-
Notifications
You must be signed in to change notification settings - Fork 55
/
vite.config.ts
31 lines (30 loc) · 1007 Bytes
/
vite.config.ts
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
import { defineConfig } from 'vite';
import { createUnplugin } from 'unplugin';
import { resolveSemcoreSources } from './website/docs/.vitepress/resolve-semcore-sources';
import { loadSemcoreSources } from './website/docs/.vitepress/load-semcore-sources';
import pluginReact from '@vitejs/plugin-react';
export default defineConfig({
plugins: [
pluginReact(),
createUnplugin<{}>(() => ({
name: 'semcore-resolve',
async resolveId(id) {
if (
!id.includes('@semcore') &&
!id.includes('/semcore/') &&
!id.startsWith('intergalactic/')
)
return null;
if (id.endsWith('.md') || id.endsWith('.mdx') || id.includes('stories')) return null;
return await resolveSemcoreSources(id);
},
loadInclude: (id) => {
return id.includes('/semcore/') || id.includes('stories/');
},
async load(id) {
return await loadSemcoreSources(id);
},
enforce: 'pre',
})).vite({}),
],
});