-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
57 lines (52 loc) · 1.16 KB
/
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
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
import vue from "@vitejs/plugin-vue";
import * as path from "path";
import { defineConfig } from "vite";
import dts from "vite-plugin-dts";
import licence from "rollup-plugin-license";
export const config = {
css: {
preprocessorOptions: {
scss: {
api: "modern",
},
},
},
} as any;
export const ruLicence = (id: String) => {
let fileName = `${id}.licence.txt`;
return licence({
sourcemap: true,
banner: {
content: `@license
https://raw.githubusercontent.com/indus/dv-scalebar/refs/heads/main/dist/${fileName}`,
},
thirdParty: {
output: `./dist/${fileName}`,
includeSelf: true,
},
});
};
const fileName = "dv-scalebar.vue";
export default defineConfig(Object.assign({}, config, {
plugins: [
vue(),
dts({
beforeWriteFile: (filePath) => <any> !filePath.endsWith("dts.d.ts"),
}),
],
build: {
emptyOutDir: false,
lib: {
entry: path.resolve(__dirname, "src/scalebar.vue"),
name: "Scalebar",
fileName,
},
rollupOptions: {
external: ["vue"],
output: {
globals: { vue: "Vue" },
},
plugins: [ruLicence(fileName)],
},
},
}));