build: add Cloudflare static export and deploy config
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user