-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
40 lines (39 loc) · 1.06 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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { exec } from "node:child_process";
import { resolve } from "node:path";
import { externalizeDeps } from "vite-plugin-externalize-deps";
// https://vitejs.dev/config/
export default defineConfig({
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, "src/tolgee-editor.ts"),
fileName: "tolgee-editor",
name: "@tolgee/editor",
formats: ["es", "cjs"],
},
rollupOptions: {},
},
plugins: [
react(),
externalizeDeps(),
{
name: "build-parser",
watchChange(id) {
if (id.indexOf("tolgee.grammar") !== -1) {
exec("npm run --silent grammar", (_, stdout, stderr) => {
if (stdout) {
process.stdout.write(stdout);
process.stdout.write("\n");
}
if (stderr) {
process.stderr.write(stderr);
process.stderr.write("\n");
}
});
}
},
},
],
});