-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
59 lines (51 loc) · 1.41 KB
/
vite.config.js
File metadata and controls
59 lines (51 loc) · 1.41 KB
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
import { defineConfig } from "vite";
import { resolve } from "path";
import { openScriptComponentPlugin } from "./build/vite-plugin-openscript.js";
export default defineConfig({
plugins: [openScriptComponentPlugin()],
// CSS configuration
css: {
postcss: "./postcss.config.js",
},
build: {
lib: {
// Entry point for the library
entry: resolve(__dirname, "src/index.js"),
name: "OpenScript",
// Output formats
formats: ["es", "umd"],
fileName: (format) => `modular-openscriptjs.${format}.js`,
},
rollupOptions: {
// Preserve module structure
output: {
// Use named exports only (no default export)
exports: "named",
// Preserve original names where possible
preserveModules: false,
// Ensure component names are kept in comments
banner:
"/* OpenScript Framework - Built with component name preservation */",
},
},
// Source maps for debugging
sourcemap: true,
// Target modern browsers
target: "es2020",
minify: "terser",
terserOptions: {
// Preserve class names
keep_classnames: true,
keep_fnames: true,
mangle: {
// Don't mangle properties that start with these patterns
reserved: ["Component", "State", "Mediator", "Broker"],
},
},
},
resolve: {
alias: {
"@": resolve(__dirname, "./"),
},
},
});