-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
46 lines (44 loc) · 1.34 KB
/
vite.config.js
File metadata and controls
46 lines (44 loc) · 1.34 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
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import legacy from '@vitejs/plugin-legacy'
// javascript obfuscator
import { obfuscator } from 'rollup-obfuscator';
import sd from 'silly-datetime'
const getZoneTime = (offset)=> {
let localtime = new Date();
let localmesc = localtime.getTime();
let localOffset = localtime.getTimezoneOffset() * 60000;
let utc = localOffset + localmesc;
let calctime = utc + (3600000 * offset);
return new Date(calctime);
}
// https://vitejs.dev/config/
export default ({mode}) => {
process.env.VITE_BUILD_TIME = sd.format(getZoneTime(8), 'YYYY-MM-DD HH:mm:ss');
return defineConfig({
plugins: [
vue(),
obfuscator({
// see https://github.com/javascript-obfuscator/javascript-obfuscator#javascript-obfuscator-options
debugProtection: true,
debugProtectionInterval: 500,
splitStrings: true,
renameGlobals: true,
}),
legacy({
targets: ['defaults']
}),
],
build: {
assetsInlineLimit: 1024 * 1024,
chunkSizeWarningLimit: 1024*1024,
rollupOptions: {
output: {
entryFileNames: 'assets/bobh.encrypted.[name].[hash].js',
chunkFileNames: 'assets/bobh.chunk.[name].[hash].js',
assetFileNames: 'assets/bobh.assets.[name].[hash].[ext]',
}
}
}
});
}