-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
39 lines (37 loc) · 995 Bytes
/
vite.config.ts
File metadata and controls
39 lines (37 loc) · 995 Bytes
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
import { defineConfig } from 'vite'
import { fileURLToPath } from 'node:url'
import path from 'node:path'
import fs from 'node:fs'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const demoRoot = path.resolve(__dirname, 'examples/browser')
const liteBuildPath = path.resolve(__dirname, 'dist/lite/index.js')
const liteAliasTarget = fs.existsSync(liteBuildPath)
? liteBuildPath
: path.resolve(__dirname, 'src/index.ts')
export default defineConfig({
root: demoRoot,
resolve: {
alias: [
{
find: '@knighted/jsx/lite',
replacement: liteAliasTarget,
},
{
find: '@knighted/jsx',
replacement: path.resolve(__dirname, 'src/index.ts'),
},
],
},
optimizeDeps: {
exclude: ['oxc-parser', '@oxc-parser/binding-wasm32-wasi'],
},
assetsInclude: ['**/*.wasm'],
build: {
outDir: path.resolve(demoRoot, 'dist'),
emptyOutDir: true,
},
server: {
open: true,
},
})