-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.config.ts
56 lines (54 loc) · 1.47 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
/// <reference types="vitest" />
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import { configDefaults } from 'vitest/config';
import vue from '@vitejs/plugin-vue';
import dts from 'vite-plugin-dts'
import options from './rollupOptions.mjs';
import cssNameNormalizer from './vite-plugin-css-name-normalizer';
const version = process.env.npm_package_version;
// https://vitejs.dev/config/
export default defineConfig({
base: '/rei-cedar/',
build: {
cssCodeSplit: true,
lib: {
entry: './src/lib.ts',
formats: ['es'],
fileName: '[name]',
},
rollupOptions: options,
},
server: {
port: 3000,
},
css: {
modules: {
generateScopedName: (name) => `${name}_${version.replace(/\./g, '-')}`,
},
},
resolve: {
alias: {
srcdir: fileURLToPath(new URL('./src', import.meta.url)),
cssdir: fileURLToPath(new URL('./src/css', import.meta.url)),
componentsdir: fileURLToPath(new URL('./src/components', import.meta.url)),
mixinsdir: fileURLToPath(new URL('./src/mixins', import.meta.url)),
'~': fileURLToPath(new URL('./node_modules', import.meta.url)),
},
},
test: {
globals: true,
exclude: [...configDefaults.exclude, '**/test/playwright', '**/templates/__tests__'],
environment: 'jsdom',
css: {
modules: {
classNameStrategy: 'non-scoped'
},
},
},
plugins: [
vue(),
cssNameNormalizer(),
dts({ rollupTypes: true }),
],
});