Switch to static export with build-time data fetching
- Change from server-side rendering to static export - Fetch data at build time and save as JSON - Remove API routes and tests, use static JSON file - Switch back to WEB platform from WEB_COMPUTE - Update build test for static export - Exclude out directory from security scan - Much simpler and more reliable approach
This commit is contained in:
@@ -26,8 +26,7 @@ try {
|
||||
// Check for required files
|
||||
console.log('\n🔍 Checking build output...');
|
||||
const checks = [
|
||||
{ path: '.next/standalone/server.js', name: 'Standalone server' },
|
||||
{ path: '.next/standalone/.next/required-server-files.json', name: 'Required server files' },
|
||||
{ path: 'out/index.html', name: 'Static HTML output' },
|
||||
{ path: '.next/static', name: 'Static directory' },
|
||||
];
|
||||
|
||||
@@ -41,26 +40,6 @@ for (const check of checks) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test the copy command
|
||||
console.log('\n📋 Testing copy command...');
|
||||
try {
|
||||
execSync('cp -r .next/static .next/standalone/.next/', { stdio: 'inherit' });
|
||||
console.log('✅ Copy command successful');
|
||||
} catch (e) {
|
||||
console.error('❌ Copy command failed');
|
||||
allPassed = false;
|
||||
}
|
||||
|
||||
// Check final structure
|
||||
console.log('\n📁 Final structure check...');
|
||||
const finalPath = '.next/standalone/.next/static';
|
||||
if (fs.existsSync(finalPath)) {
|
||||
console.log('✅ Static files copied successfully');
|
||||
} else {
|
||||
console.error('❌ Static files not in final location');
|
||||
allPassed = false;
|
||||
}
|
||||
|
||||
if (!allPassed) {
|
||||
console.error('\n❌ Build test failed! Do not push.');
|
||||
process.exit(1);
|
||||
|
||||
Reference in New Issue
Block a user