-
Notifications
You must be signed in to change notification settings - Fork 59
/
vite.cdn.config.js
52 lines (51 loc) · 1.22 KB
/
vite.cdn.config.js
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
import { defineConfig } from "vite";
import { svelte } from "@sveltejs/vite-plugin-svelte";
import { resolve } from "path";
import viteRawPlugin from "./vite/vite-raw-plugin.js";
import cleanDistCdn from './vite/clean-dist-cdn.js';
import banner from "vite-plugin-banner";
import pkg from "./package.json";
// https://vitejs.dev/config/
export default defineConfig({
root: "src",
plugins: [
banner({
content:
`/* NightVisionCharts v${pkg.version} | License: MIT\n` +
` © 2022 ChartMaster. All rights reserved */`,
outDir: "../dist/cdn"
}),
svelte({
emitCss: false,
}),
viteRawPlugin({
fileRegex: /\.navy$/,
}),
],
build: {
target: "es2018",
outDir: "../dist/cdn",
emptyOutDir: true,
inlineDynamicImports: true,
lib: {
entry: resolve(__dirname, "src/index.js"),
name: "NightVision",
fileName: (format) => `night-vision.${format}.js`
},
rollupOptions: {
output: {
entryFileNames: "night-vision.min.js",
format: 'umd'
},
plugins: [
{
name: 'cleanup-dist',
writeBundle() {
cleanDistCdn();
}
}
]
},
minify: true,
},
});