-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
69 lines (63 loc) · 2.44 KB
/
vite.config.js
File metadata and controls
69 lines (63 loc) · 2.44 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
57
58
59
60
61
62
63
64
65
66
67
68
69
/* =========================================================================
vite.config.js
Copyright © 2025-2026 Network Pro Strategies (Network Pro™)
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
This file is part of Network Pro.
========================================================================= */
import { sveltekit } from '@sveltejs/kit/vite';
//import { resolve } from 'node:path';
//import { fileURLToPath } from 'node:url';
import { defineConfig } from 'vite';
//import devtoolsJson from 'vite-plugin-devtools-json';
import lightningcssPlugin from 'vite-plugin-lightningcss';
// Compute absolute project root
//const projectRoot = fileURLToPath(new URL('.', import.meta.url));
export default defineConfig(({ mode }) => {
// --- 🧩 Log Build Environment Info -------------------------------------
console.log(
'\x1b[36m%s\x1b[0m',
'──────────────────────────────────────────────',
);
console.log('\x1b[33m%s\x1b[0m', `📦 Building Network Pro — mode: ${mode}`);
console.log(
'\x1b[36m%s\x1b[0m',
'──────────────────────────────────────────────',
);
console.log('ENV_MODE:', process.env.ENV_MODE);
console.log('PUBLIC_ENV_MODE:', process.env.PUBLIC_ENV_MODE);
console.log('NODE_ENV:', process.env.NODE_ENV);
if (
process.env.ENV_MODE === 'audit' ||
process.env.PUBLIC_ENV_MODE === 'audit' ||
mode === 'audit'
) {
process.stderr.write(
'🔒 Audit Mode Detected — hardened CSP and no analytics will be applied.\n',
);
}
console.log(
'\x1b[36m%s\x1b[0m',
'──────────────────────────────────────────────',
);
// -----------------------------------------------------------------------
return {
envPrefix: ['PUBLIC_'],
resolve: {
tsconfigPaths: true,
},
plugins: [
//devtoolsJson({
//projectRoot: resolve(projectRoot),
//normalizeForWindowsContainer: true,
//uuid: 'ad0db4f4-6172-4c1e-ae17-26b1bee53764',
//}),
sveltekit(),
lightningcssPlugin({
minify: ['production', 'audit'].includes(mode),
pruneUnusedFontFaceRules: true,
pruneUnusedKeyframes: true,
removeUnusedFontFaces: true,
}),
],
};
});