-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.subpath.config.js
More file actions
36 lines (33 loc) · 864 Bytes
/
Copy pathvite.subpath.config.js
File metadata and controls
36 lines (33 loc) · 864 Bytes
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
import { defineConfig } from "vite";
import { readFileSync } from "node:fs";
const pkg = JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf-8")
);
const externals = [
...Object.keys(pkg.dependencies ?? {}),
...Object.keys(pkg.peerDependencies ?? {}),
];
export default defineConfig(() => ({
plugins: [],
build: {
outDir: "dist",
target: "es2020",
sourcemap: false,
lib: {
entry: {
client: "entries/client.mjs",
router: "entries/router.mjs",
ssr: "entries/ssr.mjs",
hydration: "entries/hydration.mjs",
mdx: "entries/mdx.mjs",
},
formats: ["es", "cjs"],
fileName: (format, entryName) =>
format === "es" ? `${entryName}.mjs` : `${entryName}.cjs`,
},
rollupOptions: {
external: externals,
},
emptyOutDir: false,
},
}));