-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
69 lines (66 loc) · 2.19 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
import { defineConfig, LibraryFormats } from 'vite';
import react from '@vitejs/plugin-react';
import typescript from '@rollup/plugin-typescript';
import path from 'path';
const isDev = process.env.NODE_ENV === 'developent';
export default defineConfig(() => {
return {
define: {
'process.env': {},
},
build: {
outDir: 'dist',
assetsInlineLimit: 0,
sourcemap: false,
reportCompressedSize: true,
minify: true,
lib: {
entry: path.resolve(__dirname, './src/index.tsx'),
name: 'react-lib',
fileName: 'index',
},
rollupOptions: {
external: ['react', 'react-dom'],
input: {
index: path.resolve(__dirname, 'src/index.tsx'),
// Include the JSON file
mockListe: path.resolve(__dirname, 'src/assets/mockdata/af-liste.json'),
mockDetaljert: path.resolve(__dirname, 'src/assets/mockdata/af-detaljert.json'),
},
output: [
{
format: 'es' as LibraryFormats,
entryFileNames: '[name].esm.js',
dir: 'dist',
},
{
format: 'cjs' as LibraryFormats,
entryFileNames: '[name].cjs.js',
dir: 'dist',
},
],
plugins: [
typescript({
sourceMap: false,
declaration: true,
declarationDir: 'dist/types',
outDir: 'dist',
exclude: 'node_modules/**',
}),
],
},
css: {
modules: {
scopeBehaviour: 'local',
},
},
},
base: isDev ? '' : process.env.PUBLIC_URL,
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
};
});