-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
70 lines (68 loc) · 1.79 KB
/
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
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
/* eslint-disable import/no-extraneous-dependencies */
/// <reference types="vitest" />
/// <reference types="vite/client" />
import react from '@vitejs/plugin-react-swc';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const base = process.env.BASE_PATH || './';
return {
root: './',
base,
server: {
// port: 3000,
open: '/index.html',
// open: '/bsdd_selection/index.html',
// open: '/bsdd_search/index.html',
},
build: {
target: 'esnext',
external: ['react', 'react-dom'],
outDir: './dist',
// lib: {
// entry: 'src/lib/index.ts',
// name: 'bSDD',
// fileName: (format) => `[name]-${format}.js`,
// formats: ['es'],
// },
rollupOptions: {
input: {
bsdd_selection: 'bsdd_selection/index.html',
bsdd_search: 'bsdd_search/index.html',
bsdd_search_settings: 'bsdd_search_settings/index.html',
main: 'index.html',
},
// output: {
// entryFileNames: '[name].js',
// chunkFileNames: '[name].js',
// assetFileNames: '[name].[ext]',
// manualChunks: undefined,
// },
},
},
plugins: [
react(),
dts(
{
include: ['src/lib/**/*'],
outDir: 'dist',
entryRoot: 'src/lib',
}
),
],
preview: {
open: true,
},
test: {
globals: true,
environment: 'jsdom',
// setupFiles: './src/setupTests.ts',
},
define: {
// Catch for 'Uncaught ReferenceError: process is not defined'
'process.env.NODE_ENV': `"${process.env.NODE_ENV}"`,
'process.env.APP_MODE': JSON.stringify(mode),
},
};
});