-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathvite.config.ts
34 lines (33 loc) · 1.05 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
import { defineConfig } from 'vitest/config';
import path from 'node:path';
import preserveDirectives from 'rollup-plugin-preserve-directives';
import dts from 'vite-plugin-dts';
export default defineConfig({
plugins: [dts({ insertTypesEntry: true }), preserveDirectives()],
build: {
lib: {
entry: [
path.resolve(__dirname, 'src', 'index.ts'),
path.resolve(__dirname, 'src', 'rsc/index.ts'),
],
name: 'storyblokReact',
fileName: (format, entry) => {
const isRscEntry = entry.includes('rsc/index');
const name = isRscEntry ? 'rsc' : entry.split('/').pop();
return format === 'es' ? `${name}.mjs` : `${name}.js`;
},
},
rollupOptions: {
external: ['react', 'react/jsx-runtime', 'react-dom', 'react-dom/client', 'next/cache'],
output: {
preserveModules: true,
globals: { react: 'React' },
},
},
},
test: {
globals: true,
include: ['./src/__tests__/**/*'],
exclude: ['./src/__tests__/cypress', './src/__tests__/testing-components'],
},
});