-
-
Notifications
You must be signed in to change notification settings - Fork 553
/
vite.config.ts
46 lines (45 loc) · 1.01 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
35
36
37
38
39
40
41
42
43
44
45
46
import { defineConfig } from 'vite'
import typescript from '@rollup/plugin-typescript'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import * as path from 'path'
export default defineConfig(({ mode }) => {
const name = 'canvas-editor'
if (mode === 'lib') {
return {
plugins: [
cssInjectedByJsPlugin({
styleId: `${name}-style`,
topExecutionPriority: true
}),
{
...typescript({
tsconfig: './tsconfig.json',
include: ['./src/editor/**']
}),
apply: 'build',
declaration: true,
declarationDir: 'types/',
rootDir: '/'
}
],
build: {
lib: {
name,
fileName: name,
entry: path.resolve(__dirname, 'src/editor/index.ts')
},
rollupOptions: {
output: {
sourcemap: true
}
}
}
}
}
return {
base: `/${name}/`,
server: {
host: '0.0.0.0'
}
}
})