-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
77 lines (74 loc) · 2.08 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import path from 'path'
import { defineConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'
import WindiCSS from 'vite-plugin-windicss'
import tsconfigPaths from 'vite-tsconfig-paths'
import monacoEditorPlugin from 'vite-plugin-monaco-editor'
const libname = 'kl-element-ui'
export default defineConfig({
resolve: {
// alias: [
// {
// find: '@',
// replacement: __dirname
// },
// {
// find: '~',
// replacement: path.resolve(__dirname, 'packages')
// },
// ]
},
plugins: [
createVuePlugin({ jsx: true }),
WindiCSS(),
tsconfigPaths(),
monacoEditorPlugin({
// languageWorkers: ['html', 'css', 'json', 'typescript', 'editorWorkerService']
})
],
build: {
outDir: 'lib',
lib: {
entry: path.resolve(__dirname, 'packages/index.ts'),
name: libname,
formats: ['es', 'umd', 'cjs'],
fileName: (format) => `${libname}.${format}.js`,
},
rollupOptions: {
external: [
'vue',
'vue-router',
'element-ui',
'vue-fragment',
'lodash',
'rule-judgment',
'monaco-editor',
'@kenote/common',
'js-yaml',
'nunjucks'
],
output: {
exports: 'named',
globals: {
vue: 'Vue',
lodash: 'lodash',
nunjucks: 'nunjucks',
['monaco-editor']: 'monaco-editor',
['element-ui']: 'element-ui',
['vue-fragment']: 'vue-fragment',
['js-yaml']: 'js-yaml',
['rule-judgment']: 'rule-judgment',
['@kenote/common']: '@kenote/common'
},
// manualChunks: {
// jsonWorker: [`monaco-editor/esm/vs/language/json/json.worker`],
// cssWorker: [`monaco-editor/esm/vs/language/css/css.worker`],
// htmlWorker: [`monaco-editor/esm/vs/language/html/html.worker`],
// tsWorker: [`monaco-editor/esm/vs/language/typescript/ts.worker`],
// editorWorker: [`monaco-editor/esm/vs/editor/editor.worker`]
// }
}
},
emptyOutDir: true,
}
})