This workshop will be retired on May 31, 2024.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Learn how to deploy your React app with minimal configuration, using Now.
UPDATE
Zeit has rebranded and is now called Vercel! To create an account visit vercel.com/home and click the "Sign Up" button on the top right.
Installing Vercel CLI In the terminal you can either install it globally with the command:
npm i -g vercel
Or you can install it locally inside the project with the command:
npm i vercel
Then in the terminal run:
vercel
The first time you do this it will ask you to "Log in to Vercel". Use the arrow keys and select github. Then follow along with the terminal. I recommend pressing the "enter" key to select the default settings.
At the end, your app has been deployed! In the terminal you should see the URL to your production built app next to "✅ Production:"
Resources
OLD NOTES
now.json Snippet
{
"version": 2,
"name": "create-react-app",
"builds": [
{ "src": "package.json", "use": "@now/static-build" }
],
"routes": [
{"src": "^/static/(.*)", "dest": "/static/$1"},
{"src": "^/favicon.ico", "dest": "/favicon.ico"},
{"src": "^/asset-manifest.json", "dest": "/asset-manifest.json"},
{"src": "^/manifest.json", "dest": "/manifest.json"},
{"src": "^/service-worker.js", "headers": {"cache-control": "s-maxage=0"}, "dest": "/service-worker.js"},
{"src": "^/precache-manifest.(.*)", "dest": "/precache-manifest.$1"},
{"src": "^/(.*)", "dest": "/index.html"}
]
}
package.json Script
"scripts": {
...
"now-build": "react-scripts build && mv build dist"
}
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up