2022-12-10 12:14:48 +03:00
|
|
|
import preact from '@preact/preset-vite';
|
2022-12-15 09:42:34 +03:00
|
|
|
import { execSync } from 'child_process';
|
2022-12-13 15:42:09 +03:00
|
|
|
import { resolve } from 'path';
|
2022-12-15 06:47:11 +03:00
|
|
|
import { defineConfig, splitVendorChunkPlugin } from 'vite';
|
2022-12-10 12:14:48 +03:00
|
|
|
|
2022-12-15 09:42:34 +03:00
|
|
|
const commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
|
|
|
|
2022-12-10 12:14:48 +03:00
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2022-12-15 09:42:34 +03:00
|
|
|
define: {
|
|
|
|
__BUILD_TIME__: JSON.stringify(Date.now()),
|
|
|
|
__COMMIT_HASH__: JSON.stringify(commitHash),
|
|
|
|
},
|
2022-12-15 06:47:11 +03:00
|
|
|
plugins: [preact(), splitVendorChunkPlugin()],
|
2022-12-13 15:42:09 +03:00
|
|
|
build: {
|
2022-12-15 06:47:11 +03:00
|
|
|
sourcemap: true,
|
2022-12-13 15:42:09 +03:00
|
|
|
rollupOptions: {
|
|
|
|
input: {
|
|
|
|
main: resolve(__dirname, 'index.html'),
|
|
|
|
compose: resolve(__dirname, 'compose/index.html'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2022-12-10 12:14:48 +03:00
|
|
|
});
|