-
Notifications
You must be signed in to change notification settings - Fork 293
Expand file tree
/
Copy pathvite.config.ts
More file actions
40 lines (38 loc) · 1.29 KB
/
vite.config.ts
File metadata and controls
40 lines (38 loc) · 1.29 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
import { resolve } from 'path';
import { defineConfig } from 'vite';
import { name, dependencies, peerDependencies } from './package.json';
import { compilerOptions } from './tsconfig.lib.json';
import getPackageVersion from './scripts/get-package-version.mjs';
const external = [
...Object.keys(dependencies),
...Object.keys(peerDependencies),
// regex patterns to match subpaths of external dependencies
// e.g. @stream-io/abc and @stream-io/abc/xyz (without this, Vite bundles subpaths)
].map((dependency) => new RegExp(`^${dependency}(\\/[\\w-]+)?$`));
export default defineConfig({
build: {
lib: {
entry: {
index: resolve(__dirname, './src/index.ts'),
emojis: resolve(__dirname, './src/plugins/Emojis/index.ts'),
'mp3-encoder': resolve(__dirname, './src/plugins/encoders/mp3.ts'),
experimental: resolve(__dirname, './src/experimental/index.ts'),
},
fileName(format, entryName) {
return `${format}/${entryName}.${format === 'cjs' ? 'js' : 'mjs'}`;
},
name,
},
emptyOutDir: false,
outDir: 'dist',
minify: false,
sourcemap: true,
target: compilerOptions.target,
rollupOptions: {
external,
},
},
define: {
'process.env.STREAM_CHAT_REACT_VERSION': JSON.stringify(getPackageVersion()),
},
});