-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathvite.config.ts
More file actions
60 lines (58 loc) · 1.71 KB
/
vite.config.ts
File metadata and controls
60 lines (58 loc) · 1.71 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { resolve } from 'path'
import react from '@vitejs/plugin-react'
import { defineConfig, searchForWorkspaceRoot } from 'vite'
// TODO(sqs): un-hardcode
const docsProviderDataDir = resolve('/Users/sqs/tmp/octx-provider-docs')
export default defineConfig(({ mode }) => ({
plugins: [react()],
resolve: {
alias: [
...(mode === 'development'
? [
// In dev mode, build from TypeScript sources so we don't need to run `tsc -b`
// in the background.
//
// TODO(sqs): dedupe with other places in this repo that do this
{
find: /^(@openctx\/[\w-]+)$/,
replacement: '$1/src/index',
},
]
: []),
{
find: 'tmp-octx-provider-docs',
replacement: docsProviderDataDir,
},
],
},
define: {},
css: {
devSourcemap: true,
modules: {
localsConvention: 'camelCaseOnly',
},
},
server: {
port: 5900,
fs: {
allow: [searchForWorkspaceRoot(process.cwd()), docsProviderDataDir],
},
},
build: {
emptyOutDir: false,
outDir: 'dist',
rollupOptions: {
watch: {
// https://rollupjs.org/configuration-options/#watch
include: ['src/**'],
exclude: ['node_modules'],
},
input: {
index: resolve(__dirname, 'index.html'),
},
output: {
entryFileNames: '[name].js',
},
},
},
}))