-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvite.config.ts
52 lines (47 loc) · 1.48 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
50
51
52
import { defineConfig } from "vite";
import { runAction, uxp, uxpSetup } from "vite-uxp-plugin";
import { svelte } from "@sveltejs/vite-plugin-svelte"; // BOLT-UXP_SVELTE_ONLY
import { sveltePreprocess } from "svelte-preprocess/dist/autoProcess"; // BOLT-UXP_SVELTE_ONLY
import react from "@vitejs/plugin-react"; // BOLT-UXP_REACT_ONLY
import vue from "@vitejs/plugin-vue"; // BOLT-UXP_VUE_ONLY
import { config } from "./uxp.config";
const action = process.env.ACTION;
const mode = process.env.MODE;
if (action) {
runAction({}, action);
process.exit();
}
const shouldNotEmptyDir =
mode === "dev" && config.manifest.requiredPermissions?.enableAddon;
export default defineConfig({
plugins: [
uxp(config, mode),
react(), // BOLT-UXP_REACT_ONLY
vue(), // BOLT-UXP_VUE_ONLY
svelte({ preprocess: sveltePreprocess({ typescript: true }) }), // BOLT-UXP_SVELTE_ONLY
],
build: {
sourcemap: mode && ["dev", "build"].includes(mode) ? true : false,
// minify: false,
emptyOutDir: !shouldNotEmptyDir,
rollupOptions: {
external: [
"photoshop", // BOLT-UXP_PHOTOSHOP_ONLY
"indesign", // BOLT-UXP_INDESIGN_ONLY
"premierepro", // BOLT-UXP_PREMIEREPRO_ONLY
"illustrator", // BOLT-UXP_ILLUSTRATOR_ONLY
"bolt-uxp-hybrid.uxpaddon", // BOLT-UXP_HYBRID_ONLY
"uxp",
"fs",
"os",
"path",
"process",
"shell",
],
output: {
format: "cjs",
},
},
},
publicDir: "public",
});