-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
50 lines (48 loc) · 1.21 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
import preact from '@preact/preset-vite';
import { resolve } from 'node:path';
import { defineConfig } from 'vite';
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
import dts from 'vite-plugin-dts';
import tsconfigPaths from 'vite-tsconfig-paths';
// versions
import { version } from './package.json';
export default defineConfig({
build: {
lib: {
entry: 'src/index.ts',
formats: ['es'],
fileName: 'index',
},
},
css: {
modules: {
localsConvention: 'camelCaseOnly',
},
preprocessorOptions: {
scss: {
additionalData: `@use "@styles/global.scss";`, // include the global scss file in the library build
api: 'modern-compiler',
},
},
},
define: {
__VERSION__: JSON.stringify(version),
},
plugins: [
cssInjectedByJsPlugin(),
dts({
tsconfigPath: 'tsconfig.build.json',
}),
preact(),
tsconfigPaths({
configNames: ['tsconfig.build.json'],
}),
],
resolve: {
alias: {
// resolutions needed for sass, typescript resolutions handled by the vite-tsconfig-paths plugin
'@fonts': resolve(__dirname, 'src/fonts'),
'@styles': resolve(__dirname, 'src/styles'),
},
},
});