-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathvite.config.js
More file actions
44 lines (40 loc) · 810 Bytes
/
Copy pathvite.config.js
File metadata and controls
44 lines (40 loc) · 810 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
40
41
42
43
44
/*
* @Author: Yaowen Liu
* @Date: 2022-03-24 09:35:56
* @LastEditors: Yaowen Liu
* @LastEditTime: 2022-03-24 13:40:52
*/
// vite.config.js
import path from 'path'
import { defineConfig } from 'vite'
import { createVuePlugin } from 'vite-plugin-vue2'
const target = process.env.TARGET
let buildConfig = {
outDir: 'netlify-page',
}
if (target === 'npm') {
buildConfig = {
lib: {
entry: path.resolve(__dirname, 'lib/index.js'),
name: 'MyLib',
fileName: (format) => `my-lib.${format}.js`,
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
}
}
export default defineConfig({
build: { ...buildConfig },
plugins: [
createVuePlugin(/* options */)
],
server: {
open: true,
},
})