What are you most proud of, and what would you do differently next time?
Solution Retrospective: Netlify Deployment Challenges
What I’m Most Proud Of
- Debugging Skills – I learned how to interpret Netlify build logs effectively, identifying both ESLint errors and configuration mismatches.
- CI/CD Understanding – Now I better grasp how `process. env.CI affects builds, and why warnings become errors in deployment.
- React Build Process – I confirmed that
create-react-app
outputs to /build
(not /dist
), a key insight for fixing deployment.
What I’d Do Differently Next Time
- Pre-Deployment Testing – Before pushing to Netlify, I’d:
- Run
npm run build
locally to ensure no ESLint warnings.
- Verify the correct output folder (
build/
vs. dist/
).
- Use a
netlify.toml
File – Instead of relying on Netlify’s UI settings, I’d define:
[build]
command = "npm run build"
publish = "build" # Explicitly set for CRA
to avoid misconfigurations.
- Stricter Local ESLint Rules—To catch issues earlier, I’d match my local ESLint config to Netlify’s CI behaviour ("no-unused-vars": "error").
Where I’d Like Support
- Optimising Builds: Can I skip ESLint in production builds safely?
- Alternative Deployment Strategies: Should I use
vite
instead of CRA for faster builds?
- Netlify Caching: How can I speed up repeated deployments?
Sharing this helps others avoid similar pitfalls! 🚀 Would love feedback or additional tips from the community.
What challenges did you encounter, and how did you overcome them?
- Netlify Couldn’t Find the Build Directory
Problem: Netlify expected files in /dist, but create-react-app outputs to /build.
Solution:
Updated Netlify’s "Publish directory" from dist to build.
Alternatively, added Netlify.toml file to explicitly define:
toml
[build]
publish = "build"
2. ESLint Warnings Failed the Build
Problem: Netlify treats warnings as errors in CI (process.env.CI = true).
Solution:
Fixed the code: Removed unused variables (e.g., 'use' in Tabs.js).
Temporary workaround: Disabled strict CI checks by setting CI=false in the build command.
Long-term fix: Adjusted ESLint rules in .eslintrc.json to downgrade no-unused-vars to "warn".
- Debugging Opaque Build Errors
Problem: Netlify’s logs showed exit code 2 without clear details.
Solution:
Ran npm run build locally to replicate the error.
Checked the full error output in the terminal (which was more descriptive than Netlify’s UI).
- Configuration Mismatches
Problem: Default Netlify settings didn’t align with create-react-app.
Solution:
Verified local vs. production behaviour by comparing package.json scripts.
Explicitly defined settings in Netlify.toml to override defaults.
Key Takeaways
Test builds locally first to catch issues early.
Always check the actual build output folder (e.g., build/ vs. dist/).
Configure ESLint to match CI behaviour to avoid surprises.
By breaking down each error methodically, I turned deployment hurdles into learning opportunities! 🛠️ Would love to hear how others handled similar issues.
What specific areas of your project would you like help with?
- Optimising the Build Pipeline
Question: Is there a way to speed up Netlify builds for a create-react-app project?
Specific Needs:
Can I safely skip ESLint in production builds without risking code quality?
Are there caching strategies (e.g., node_modules caching) to reduce build times?
- Modernising the Stack
Question: Should I migrate from create-react-app (CRA) to Vite?
Specific Needs:
How difficult is the migration for a simple static site?
Would Vite’s faster builds outweigh the configuration effort?
- Improving Error Handling
Question: How can I make Netlify’s error logs more actionable?
Specific Needs:
Tools or scripts to parse build logs for clearer feedback.
Best practices for setting up custom error tracking (e.g., Sentry for build failures).
- Deployment Best Practices
Question: Are there better ways to structure my project for deployment?
Specific Needs:
Should I use a monorepo setup if I add backend services later?
How to handle environment variables securely in Netlify?
- Performance Tweaks
Question: What are the lowest-hanging fruit for improving Lighthouse scores?
Specific Needs:
Critical CSS extraction for a static React site.
Optimal image optimisation pipelines (e.g., Netlify plugins vs. local pre-processing).
- Community Wisdom
Open Question: What’s the most counterintuitive lesson you’ve learned from deploying React apps?
Why This Matters:
Clearer builds, faster deploys, and fewer surprises! If you’ve tackled any of these, I’d love your insights. 🚀
(For context: This is a static React landing page with minimal dependencies, but I’m planning to scale complexity over time.)