-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathvite.config.js
91 lines (89 loc) · 2.43 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
83
84
85
86
87
88
89
90
91
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue2";
import monacoEditorPlugin from "vite-plugin-monaco-editor";
import { resolve } from "path";
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
import istanbulPlugin from "vite-plugin-istanbul";
const libraryName = "VueFormBuilder";
const monacoLanguages = ["editorWorkerService", "typescript", "css", "json"];
// https://vitejs.dev/config/
export default defineConfig({
define: {
"process.env": {}
},
plugins: [
vue(),
// https://github.com/vdesjs/vite-plugin-monaco-editor/issues/21
monacoEditorPlugin({ languageWorkers: monacoLanguages }),
viteCommonjs(),
istanbulPlugin({
include: "src/**",
exclude: ["node_modules", "test/"],
extension: [".js", ".ts", ".vue"],
requireEnv: true
})
],
resolve: {
alias: [
{
find: "@",
replacement: resolve(__dirname, "src")
},
{
find: "vue",
replacement: resolve(__dirname, "node_modules/vue/dist/vue.esm.js")
},
{
find: "axios/lib",
replacement: resolve(__dirname, "node_modules/axios/lib")
}
],
extensions: [".mjs", ".js", ".vue", ".json"]
},
build: {
sourcemap: true,
lib: {
entry: resolve(__dirname, "src/components/index.js"),
name: libraryName,
fileName: (format) => `vue-form-builder.${format}.js`
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [
"vue",
"vuex",
"moment",
"moment-timezone",
"lodash",
"@processmaker/vue-form-elements",
"@processmaker/vue-multiselect",
"vue-monaco",
"monaco-editor",
"SharedComponents"
],
output: {
exports: "named",
assetFileNames: `vue-form-builder.[ext]`,
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
vue: "Vue",
vuex: "Vuex",
moment: "moment",
"moment-timezone": "moment-timezone",
lodash: "lodash",
"@processmaker/vue-form-elements": "VueFormElements",
"@processmaker/vue-multiselect": "VueMultiselect",
SharedComponents: "SharedComponents"
}
}
}
},
server: {
host: '0.0.0.0',
watch: {
ignored: ["**/coverage/**", "**/.nyc-output/**"]
}
}
});