-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathvite.reader.config.ts
32 lines (31 loc) · 1.08 KB
/
vite.reader.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
import { defineConfig } from 'vite';
import { resolve } from 'path';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: { 'process.env.NODE_ENV': '"production"' },
build: {
// We always run this build after the app build, so we don't want to destroy it.
emptyOutDir: false,
lib: {
entry: resolve(__dirname, 'reader/Reader.tsx'),
name: 'Bookish',
fileName: 'bookish',
// Make an immediately evaluated function suitable for script import by books.
formats: ['iife'],
},
rollupOptions: {
output: {
entryFileNames: (assetInfo) =>
assetInfo.name === 'Reader'
? 'bookish.js'
: assetInfo.name ?? '',
assetFileNames: (assetInfo) =>
assetInfo.name === 'style.css'
? 'bookish.css'
: assetInfo.name ?? '',
},
},
},
});