-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
30 lines (28 loc) · 893 Bytes
/
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
import { defineConfig } from "vite"
import pkg from "./package.json"
import { qwikVite } from "@builder.io/qwik/optimizer"
import tsconfigPaths from "vite-tsconfig-paths"
const { dependencies = {}, peerDependencies = {} } = pkg as any
const makeRegex = dep => new RegExp(`^${dep}(/.*)?$`)
const excludeAll = obj => Object.keys(obj).map(makeRegex)
export default defineConfig(() => {
return {
build: {
target: "ES2022",
lib: {
entry: "./src/index.ts",
formats: ["es", "cjs"],
fileName: format => `index.qwik.${format === "es" ? "mjs" : "cjs"}`,
},
rollupOptions: {
// externalize deps that shouldn't be bundled into the library
external: [
/^node:.*/,
...excludeAll(dependencies),
...excludeAll(peerDependencies),
],
},
},
plugins: [qwikVite(), tsconfigPaths()],
}
})