-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
45 lines (44 loc) · 1.02 KB
/
vite.config.ts
File metadata and controls
45 lines (44 loc) · 1.02 KB
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
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { resolve } from 'path';
import { copyFileSync, existsSync } from 'fs';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [
svelte(),
dts({
include: ['src/**/*.ts', 'src/**/*.svelte'],
exclude: ['src/**/*.test.ts', 'src/**/*.stories.ts']
}),
{
name: 'copy-css',
closeBundle() {
// Only copy CSS when building the library (dist folder exists)
if (existsSync('dist')) {
copyFileSync('src/styles.css', 'dist/styles.css');
}
}
}
],
build: {
lib: {
entry: resolve(__dirname, 'src/index.ts'),
name: 'PatternFlySvelte',
fileName: 'index',
formats: ['es']
},
rollupOptions: {
external: ['svelte'],
output: {
globals: {
svelte: 'Svelte'
}
}
}
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/test/setup.ts']
}
});