forked from CenturyLink/Chi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite-js.config.ts
More file actions
56 lines (52 loc) · 1.67 KB
/
vite-js.config.ts
File metadata and controls
56 lines (52 loc) · 1.67 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
53
54
55
56
import { defineConfig } from 'vite';
import { resolve } from 'path';
import banner from 'vite-plugin-banner';
import { terser } from 'rollup-plugin-terser';
const copyright = `Chi and its documentation are released under the terms of the MIT license.
In addition, Chi uses several 3rd-party libraries,
a list of which can be viewed in the package.json file.
Please review each of their license and user agreements, as well.`;
const footer = `document.addEventListener('mousedown', function (e) { if (!document.body.classList.contains('-mouse-control')) { document.body.classList.add('-mouse-control'); } }); document.addEventListener('keyup', function (e) { if (e.keyCode === 9 && document.body.classList.contains('-mouse-control')) { document.body.classList.remove('-mouse-control'); } });`;
const outputFormat = process.env.JS === 'amd' ? 'amd' : 'iife';
const outDir = process.env.JS === 'amd' ? 'dist/amd' : 'dist/js';
export default defineConfig({
plugins: [
banner(copyright),
terser({
format: {
comments: false,
},
compress: {
warnings: false,
drop_console: false,
},
}),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
build: {
target: 'esnext',
outDir: outDir,
emptyOutDir: false,
minify: 'terser',
sourcemap: false,
rollupOptions: {
input: {
chi: resolve(__dirname, 'src/chi/javascript/index.js'),
},
output: {
name: 'chi',
format: outputFormat,
footer: footer,
entryFileNames: 'chi.js',
chunkFileNames: '[name].js',
},
},
},
define: {
'import.meta.env.MODE': '"production"',
},
});