-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
82 lines (80 loc) · 2.13 KB
/
vite.config.js
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
78
79
80
81
82
import {resolve} from "path"
import {defineConfig} from "vite"
import vue from "@vitejs/plugin-vue"
export default defineConfig({
plugins: [
vue(),
],
resolve: {
// Path alias configuration
alias: {
"@": resolve(__dirname, ".", "src"),
components: resolve(__dirname, "src/components/"),
constants: resolve(__dirname, "src/constants/"),
find: /^~/,
replacement: "",
img: resolve(__dirname, "assets/img"),
services: resolve(__dirname, "src/services/"),
src: resolve(__dirname, "src"),
store: resolve(__dirname, "src/store/"),
styles: resolve(__dirname, "src/assets/styles/"),
svgs: resolve(__dirname, "src/assets/svgs/"),
},
mainFields: [
"module",
],
// File suffix name that needs to be omitted
// Note: If an ignored suffix name is configured here,
// an error will be reported if it is imported with a suffix name
extensions: [
".vue",
".js",
],
},
// Mandatory pre-built plugin package
optimizeDeps: {
include: [
"vue-cal/dist/vuecal.common.js",
],
},
css: {
loaderOptions: {
less: {
lessOptions: {
javascriptEnabled: true,
},
},
},
// TODO: What does this do
modules: true,
},
// Package configuration
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/index.js"),
name: "teahub",
// the proper extensions will be added
// fileName: 'teahub'
fileName: (format) => `teahub.${format}.js`,
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
"vue",
],
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
vue: "Vue",
},
},
},
},
// Local running configuration, and reverse proxy configuration
server: {
cors: true, // enable by default and allow any source
open: true, // automatically open the application in the browser when the server starts
},
})