Merge pull request #233 from bjoaquinc/react-build-bug-fix

Fix npm run watchreact initial build bug
This commit is contained in:
Andrew Pareles 2025-01-28 20:04:51 -08:00 committed by GitHub
commit c1123f2cfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,6 +80,22 @@ const args = process.argv.slice(2);
const isWatch = args.includes('--watch') || args.includes('-w');
if (isWatch) {
// this just builds it if it doesn't exist instead of waiting for the watcher to trigger
// Check if src2/ exists; if not, do an initial scope-tailwind build
if (!fs.existsSync('src2')) {
try {
console.log('🔨 Running initial scope-tailwind build to create src2 folder...');
execSync(
'npx scope-tailwind ./src -o src2/ -s void-scope -c styles.css -p "void-"',
{ stdio: 'inherit' }
);
console.log('✅ src2/ created successfully.');
} catch (err) {
console.error('❌ Error running initial scope-tailwind build:', err);
process.exit(1);
}
}
// Watch mode
const scopeTailwindWatcher = spawn('npx', [
'nodemon',