-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
74 lines (65 loc) · 2.63 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
import vue from "@vitejs/plugin-vue";
import { defineConfig } from "vite";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import vuetify, { transformAssetUrls } from "vite-plugin-vuetify";
import { postBuildScriptRunner } from "./src/plugins/build/postBuildScriptRunner";
import { chromeDevtoolsOverrides } from "./src/plugins/build/chromeDevToolOverrides";
/**
* This is the Vite configuration file. It's used to configure the Vite bundler.
* https://vitejs.dev/config/
*/
export default defineConfig({
/**
* Plugins extend Vite. Each can be configured with options.
* https://vitejs.dev/guide/using-plugins.html
*/
plugins: [
// Handle .vue files
vue({
// https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#image-loading
template: {
transformAssetUrls,
},
}),
// Add Vuetify Components, directives, etc. This is required for Vuetify to work.
vuetify(),
// Resolves installed node modules into the bundler. See for more information:
// https://github.com/rollup/plugins/tree/master/packages/node-resolve
nodeResolve(),
// If in dev mode, copies the built applet to folders for Chrome Devtools Overrides
chromeDevtoolsOverrides(),
// Runs a script that triggers the custom xui bundler when a build finishes.
postBuildScriptRunner({ script: "npm run post-build" }),
],
/**
* Build-time configuration.
* https://vitejs.dev/config/build-options.html
*/
build: {
/**
* Applets are essentially packaged Vue components. Putting Vite into library mode
* builds a library of 1 component that can be loaded by the SSP.
* https://vitejs.dev/guide/build.html#library-mode
*/
lib: {
// CloudBolt loads Applets as ES Modules - the browser's native module format.
formats: ["es"],
// The root component the SSP should load.
entry: "src/TheApplet.vue",
// The name of the js bundle the SSP will use to load the component.
// This should match package.json's "module" field and "xuiConfig.met_entry_point"
fileName: "main.es",
},
rollupOptions: {
/**
* CloudBolt provides some of this applet's dependencies via an import map.
* This allows multiple applets to share the same dependencies, users to not
* have to download the same dependencies multiple times, and for the SSP to
* centralize the version of dependencies it uses.
* This configuration shouldn't change unless CloudBolt changes the import map
* to provide more/fewer/different dependencies.
*/
external: (id) => /^(vue|vuetify)$/.test(id),
},
},
});