-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.mts
More file actions
72 lines (68 loc) · 2.22 KB
/
vite.config.mts
File metadata and controls
72 lines (68 loc) · 2.22 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import dts from 'vite-plugin-dts';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
dts({
//root: 'lib',
// include: ['lib/**/*'],
exclude: ['src/**/*', '.storybook/**/*'],
}),
react({}),
],
build: {
lib: {
entry: resolve(__dirname, 'lib/index.ts'),
name: 'configr',
formats: ['es', 'cjs'],
fileName: (format) => `configr.${format === 'cjs' ? 'cjs' : 'es'}.js`,
},
sourcemap: true,
emptyOutDir: true,
rollupOptions: {
// don't bundle these with the library
external: [
'react',
'react/jsx-runtime.js', // Add .js extension
'react-dom',
'react-dom/client',
/^@mui\/material\/[^/]+\.js$/, // Match MUI imports with .js extension
/^@emotion\/.*$/,
],
output: {
exports: 'named',
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
react: 'React',
'react-dom': 'ReactDom',
'@emotion/react': 'emotion-react',
'@emotion/react/jsx-runtime': 'emotion-react-jsx-runtime',
'@mui/material': 'mui-material',
'@mui/material/styles': 'mui-material/styles',
'@mui/material/utils?commonjs-external': 'mui-matierial-utils',
'react/jsx-runtime.js': 'react-jsx-runtime', // Update path
'@mui/material/FormControl': 'mui-material-formcontrol',
'@mui/material/FormHelperText': 'mui-material-form-helper-text',
'@mui/material/InputLabel': 'mui-material-input-label',
'@mui/material/Select': 'mui-material-select',
},
interop: 'auto',
},
},
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
alias: {
'@mui/material/': '@mui/material/*.js',
'@mui/material/styles': '@mui/material/styles/index.js',
'@mui/material/utils': '@mui/material/utils/index.js',
//'react/jsx-runtime': 'react/jsx-runtime.js',
},
},
});