-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathvite.config.ts
More file actions
57 lines (54 loc) · 1.51 KB
/
vite.config.ts
File metadata and controls
57 lines (54 loc) · 1.51 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
50
51
52
53
54
55
56
57
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import mdx from '@mdx-js/rollup';
import remarkGfm from 'remark-gfm';
import rehypeMdxCodeProps from 'rehype-mdx-code-props';
import path from 'path';
import { readFileSync } from 'fs';
const reactPkg = path.resolve(__dirname, '../../packages/react/package.json');
const reactSrc = path.resolve(__dirname, '../../packages/react/src');
const iconsSrc = path.resolve(__dirname, '../../packages/icons/src');
const chartsSrc = path.resolve(__dirname, '../../packages/charts/src');
const tinyVersion = JSON.parse(readFileSync(reactPkg, 'utf-8')).version;
export default defineConfig({
base: process.env.VITE_BASE || '/',
define: {
__TINY_VERSION__: JSON.stringify(tinyVersion),
},
plugins: [
{ enforce: 'pre', ...mdx({
mdxExtensions: ['.mdx', '.md'],
mdExtensions: [],
providerImportSource: '@mdx-js/react',
remarkPlugins: [remarkGfm],
rehypePlugins: [rehypeMdxCodeProps],
}) },
react({ include: /\.(jsx|tsx|md|mdx)$/ }),
],
resolve: {
alias: {
'@tiny-design/react': reactSrc,
'@tiny-design/icons': iconsSrc,
'@tiny-design/charts': chartsSrc,
'@mdx-js/react': path.resolve(__dirname, 'node_modules/@mdx-js/react'),
},
dedupe: ['react', 'react-dom'],
},
server: {
port: 3000,
open: true,
fs: {
allow: ['../..'],
},
},
build: {
outDir: 'build',
},
css: {
preprocessorOptions: {
scss: {
api: 'modern',
},
},
},
});