-
Notifications
You must be signed in to change notification settings - Fork 5
/
vite.umd.config.ts
48 lines (45 loc) · 1.23 KB
/
vite.umd.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
/// <reference types="vitest" />
import { fileURLToPath, URL } from 'url';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import options from './rollupOptions.mjs';
options.output.preserveModules = false;
const version = process.env.npm_package_version;
// https://vitejs.dev/config/
export default defineConfig({
base: '/rei-cedar',
build: {
emptyOutDir: false,
lib: {
entry: './src/lib.ts',
formats: ['umd'],
name: 'cedar',
},
rollupOptions: {
...options,
external: (id) => ['vue', 'core-js', 'tabbable'].some(
(dep) => dep === id || id.startsWith(`${dep}/`),
),
},
},
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)),
},
},
plugins: [vue()],
});