-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
49 lines (47 loc) · 1.06 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
import type { Plugin } from 'vite'
import { mergeConfig } from 'vite'
import base from './vite.preview.config'
const genStub: Plugin = {
name: 'gen-stub',
apply: 'build',
generateBundle() {
this.emitFile({
type: 'asset',
fileName: 'ssr-stub.js',
source: 'module.exports = {}',
})
},
}
export default mergeConfig(base, {
plugins: [genStub],
optimizeDeps: {
// avoid late discovered deps
include: [
'path-browserify',
'onigasm',
'typescript',
'monaco-editor-core/esm/vs/editor/editor.worker',
'vue/server-renderer',
],
},
base: './',
build: {
target: 'esnext',
minify: false,
lib: {
entry: {
'vue-repl': './src/index.ts',
'monaco-editor': './src/editor/MonacoEditor.vue',
'codemirror-editor': './src/editor/CodeMirrorEditor.vue',
},
formats: ['es'],
fileName: () => '[name].js',
},
rollupOptions: {
output: {
chunkFileNames: 'chunks/[name]-[hash].js',
},
external: ['vue', 'vue/compiler-sfc'],
},
},
})