Update scripts/remove-cdn-for-vercel.js
This commit is contained in:
parent
cd8f2434bf
commit
2be4e996fe
|
|
@ -8,8 +8,7 @@ const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { execSync } = require('child_process');
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
console.log('
|
console.log('\n🔧 [PREBUILD] Starting Vercel preparation script...');
|
||||||
🔧 [PREBUILD] Starting Vercel preparation script...');
|
|
||||||
console.log('📋 Environment:', {
|
console.log('📋 Environment:', {
|
||||||
VERCEL: process.env.VERCEL,
|
VERCEL: process.env.VERCEL,
|
||||||
NEXT_PUBLIC_VERCEL: process.env.NEXT_PUBLIC_VERCEL,
|
NEXT_PUBLIC_VERCEL: process.env.NEXT_PUBLIC_VERCEL,
|
||||||
|
|
@ -18,8 +17,7 @@ console.log('📋 Environment:', {
|
||||||
|
|
||||||
// Seulement sur Vercel
|
// Seulement sur Vercel
|
||||||
if (process.env.VERCEL === '1' || process.env.NEXT_PUBLIC_VERCEL === '1') {
|
if (process.env.VERCEL === '1' || process.env.NEXT_PUBLIC_VERCEL === '1') {
|
||||||
console.log('✅ Running on Vercel - preparing for build...
|
console.log('✅ Running on Vercel - preparing for build...\n');
|
||||||
');
|
|
||||||
|
|
||||||
// Install Tailwind CSS v4 for Vercel build (per official docs)
|
// Install Tailwind CSS v4 for Vercel build (per official docs)
|
||||||
console.log('📦 Installing Tailwind CSS v4 packages...');
|
console.log('📦 Installing Tailwind CSS v4 packages...');
|
||||||
|
|
@ -29,8 +27,7 @@ if (process.env.VERCEL === '1' || process.env.NEXT_PUBLIC_VERCEL === '1') {
|
||||||
execSync('npm install tailwindcss @tailwindcss/postcss postcss --legacy-peer-deps', {
|
execSync('npm install tailwindcss @tailwindcss/postcss postcss --legacy-peer-deps', {
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
});
|
});
|
||||||
console.log('✅ Tailwind CSS v4 installed with lightningcss bindings
|
console.log('✅ Tailwind CSS v4 installed with lightningcss bindings\n');
|
||||||
');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Failed to install Tailwind CSS:', error.message);
|
console.error('❌ Failed to install Tailwind CSS:', error.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
@ -63,23 +60,17 @@ export function TailwindCDNLoader() {
|
||||||
fs.writeFileSync(loaderPath, emptyComponent);
|
fs.writeFileSync(loaderPath, emptyComponent);
|
||||||
const newSize = emptyComponent.length;
|
const newSize = emptyComponent.length;
|
||||||
|
|
||||||
console.log('
|
console.log('\n📊 Results:');
|
||||||
📊 Results:');
|
|
||||||
console.log(' - Original size:', originalSize, 'bytes');
|
console.log(' - Original size:', originalSize, 'bytes');
|
||||||
console.log(' - New size:', newSize, 'bytes');
|
console.log(' - New size:', newSize, 'bytes');
|
||||||
console.log(' - Removed:', originalSize - newSize, 'bytes');
|
console.log(' - Removed:', originalSize - newSize, 'bytes');
|
||||||
console.log('
|
console.log('\n✅ SUCCESS! CDN code removed from tailwind-cdn-loader.tsx');
|
||||||
✅ SUCCESS! CDN code removed from tailwind-cdn-loader.tsx');
|
console.log('🚀 Vercel build will use compiled Tailwind v4 (no CDN)\n');
|
||||||
console.log('🚀 Vercel build will use compiled Tailwind v4 (no CDN)
|
|
||||||
');
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('
|
console.log('\n❌ ERROR:', error.message);
|
||||||
❌ ERROR:', error.message);
|
console.log(' Build will continue but CDN might be present\n');
|
||||||
console.log(' Build will continue but CDN might be present
|
|
||||||
');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('⏭️ Not on Vercel - skipping CDN removal');
|
console.log('⏭️ Not on Vercel - skipping CDN removal');
|
||||||
console.log(' (CDN will be used for CodeSandbox development)
|
console.log(' (CDN will be used for CodeSandbox development)\n');
|
||||||
');
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue