This repository was archived by the owner on Feb 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
61 lines (59 loc) · 2.01 KB
/
vite.config.js
File metadata and controls
61 lines (59 loc) · 2.01 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
60
61
import {defineConfig} from "vite"
import path from "path"
import tsconfigPaths from "vite-tsconfig-paths"
import {globSync} from "glob"
import {fileURLToPath} from "node:url"
import nodeExternals from "rollup-plugin-node-externals"
import externalGlobals from "rollup-plugin-external-globals"
import nodeResolve from "@rollup/plugin-node-resolve"
export default defineConfig(({mode}) => {
const isDebug = mode === "development"
return {
plugins: [
tsconfigPaths(),
nodeExternals({
deps: false,
peerDeps: true
}),
externalGlobals({
"@skyrim-platform/skyrim-platform": "skyrimPlatform"
})
],
build: {
rollupOptions: {
input: Object.fromEntries(
globSync("src/**/*.ts").map(file => [
path.relative(
"src",
file.slice(
0,
file.length - path.extname(file).length
)
),
fileURLToPath(new URL(file, import.meta.url))
])
),
output: [
{
entryFileNames: "[name].js",
chunkFileNames: "[name]-[hash].js",
format: "esm",
dir: "dist/esm"
},
{
entryFileNames: "[name].js",
chunkFileNames: "[name]-[hash].js",
format: "cjs",
dir: "dist/cjs"
}
],
external: ["skyrimPlatform", "effect"],
preserveEntrySignatures: "allow-extension",
plugins: [nodeResolve()]
},
minify: !isDebug,
sourcemap: isDebug,
target: "esnext"
}
}
})