build: add Cloudflare static export and deploy config

This commit is contained in:
2026-10-13 12:54:06 +03:00
parent b9eddc33ee
commit 4a5c54e922
11 changed files with 369 additions and 4 deletions

View File

@@ -23,9 +23,12 @@ const sanitizeGltfLoaderInternalSurface = () => ({
},
});
export default defineConfig(() => {
export default defineConfig(({ mode }) => {
const testBuild = process.env.PORTFOLIO_TEST_BUILD === '1';
const testTokenDigest = process.env.PORTFOLIO_TEST_TOKEN_DIGEST ?? '';
if (mode === 'production-export' && (testBuild || testTokenDigest !== '')) {
throw new Error('Production exports cannot include authenticated test instrumentation.');
}
if (testBuild && !/^[a-f0-9]{64}$/u.test(testTokenDigest)) {
throw new Error('Authenticated test builds require one SHA-256 token digest.');
}
@@ -34,6 +37,8 @@ export default defineConfig(() => {
}
return {
// Export only the explicit asset closure; never load local .env or public files.
...(mode === 'production-export' ? { envDir: false as const, publicDir: false as const } : {}),
plugins: [sanitizeGltfLoaderInternalSurface(), vue()],
define: {
__PORTFOLIO_TEST_BUILD__: JSON.stringify(testBuild),