-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathvite.config.internal.ts
More file actions
52 lines (48 loc) · 1.18 KB
/
vite.config.internal.ts
File metadata and controls
52 lines (48 loc) · 1.18 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
/* eslint-disable import/no-extraneous-dependencies */
import { defineConfig } from "vite";
import { resolve } from "path";
import dts from "vite-plugin-dts";
import { globals, external, sharedConfig } from "./vite.shared";
const shared = sharedConfig(__dirname);
const INTERNAL_TYPES_ENTRY_STUB = "export * from './internal'";
export default defineConfig({
...shared,
plugins: [
dts({
rollupTypes: true,
outDir: "dist",
include: ["src/internal.ts", "src/core/**/*.ts"],
pathsToAliases: true,
entryRoot: "src",
beforeWriteFile: (filePath, content) => {
if (!filePath.endsWith("/dist/index.d.ts")) {
return { filePath, content };
}
if (content.includes(INTERNAL_TYPES_ENTRY_STUB)) {
return { filePath, content };
}
return {
filePath: filePath.replace(/\/index\.d\.ts$/, "/internal.d.ts"),
content
};
}
})
],
build: {
target: "esnext",
emptyOutDir: false,
lib: {
entry: resolve(__dirname, "src/internal.ts"),
name: "ShotstackStudioInternal",
fileName: format => `internal.${format}.js`,
formats: ["es", "umd"]
},
rollupOptions: {
external,
output: {
globals,
inlineDynamicImports: true
}
}
}
});