forked from dangmai/prettier-plugin-apex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
61 lines (59 loc) · 1.76 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
53
54
55
56
57
58
59
60
61
import react from "@vitejs/plugin-react";
import { resolve } from "path";
import { defineConfig } from "vite";
import { VitePluginRadar } from "vite-plugin-radar";
const buildTarget = process.env["BUILD_TARGET"] || "site";
const analyticsId = process.env["GOOGLE_ANALYTICS_ID"] || "";
export default defineConfig(({ mode }) => {
process.env["VITE_APP_TITLE"] =
mode === "production"
? "Salesforce Apex Formatter"
: `[${mode}] Salesforce Apex Formatter`;
return buildTarget === "library"
? {
build: {
emptyOutDir: false,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/index.ts"),
name: "prettierPlugins.apex",
// the proper extensions will be added
fileName: "src/standalone",
formats: ["umd"],
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ["prettier", "fetch"],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {
prettier: "prettier",
fetch: "fetch",
},
},
},
},
}
: {
root: resolve(__dirname, "playground"),
server: {
port: 5173,
strictPort: true,
},
plugins: [
react(),
VitePluginRadar({
enableDev: true,
analytics: {
id: analyticsId,
},
}),
],
build: {
emptyOutDir: false,
outDir: resolve(__dirname, "dist", "playground"),
},
};
});