Comments (12)
I'm deploying the build folder like suggested above, but how do you handle a catch all route to load index.html on every route with create-react-app
and Now?
from vercel.
Hello @0xsven. Do you have this resolved?
Here is a step-by-step for using create-react-app with now-serve. The steps assume that you have already installed now-serve and create-react-app.
- create your react app:
create-react-app hello-world
- go into the created react app:
cd hello-world
- build your react app for production:
npm run build
- deploy with now serve, ignoring any warnings (see note below):
ns build
I tested these exact steps and they worked for me. Looking at your posts, maybe you left out step 2 or 3.
Let us know if this resolves your issue so we can either close it or get your system working.
Note: One of the files created by the create-react-app will be larger than 1MB and will not be included in the now deployment unless you have a pay plan. The good news is that this file is a .js.map
file and will not be required for your site to function.
from vercel.
@codyzu
This worked! Thank you.
now and react. Such a powerful combination.
from vercel.
Following helped me, actually should work for any SPA. Add serve module to package.json dev dependencies and custom "now-start" script:
#yarn add --dev serve
//package.json - replace ./build with your bundle root:
...
"scripts" {
"now-start": "serve ./build --single"
...
from vercel.
This comment seems like the best way to deploy CRA to Now: #160 (comment)
It essentially mimics what now-serve
did.
from vercel.
Try this: https://github.com/xkawi/create-react-app-now
from vercel.
I was getting a similar error, @0xsven . What ended up working was running the build script in create-react-app
and subsequently using now serve to ns build
.
from vercel.
@kevmannn
I might be doing it wrong but ns build .
or ns build
are telling me: Specified path doesn't exist!
from vercel.
@0xsven great! Glad to read you got this worked out and I agree... now is real game changer!
Happy deployments!!!
from vercel.
According to Zeit, now-serve has been deprecated: https://zeit.co/blog/now-static
from vercel.
With now-serve being deprecated, I'm trying to use the now
command and getting the cache error noted above.
from vercel.
The error sounds like it's starting the dev server after deployed...
from vercel.
Related Issues (20)
- Vercel CLI 33.6.0 deploy failing with error: Invalid request: `projectSettings.nodeVersion` should be equal to one of the allowed values "20.x, 18.x, 16.x". HOT 3
- help! vercel.com not rendering on any browser
- Vercel rewrite inteferes with react router.
- Vercel is not sending CRON_SECRET in Authorization header of cron request
- X-Vercel-IP-Country header returning wrong country HOT 2
- When Turbo is detected during build, output directory no longer falls back to `.` if `public` does not exist HOT 2
- How to main same _rsc key for each link in all the pages
- Cannot find module when using aliases HOT 1
- Vercel docs recommend unmaintained library that breaks newer nextjs applications
- Running firebase CLI commands on Vercel throws: "firebase: command not found" error
- Can't deploy Python examples without Unable to find any supported Python versions. HOT 1
- StoryBook in Vercel Error: Failed to load static files, no such directory: ./.storybook/..\public
- Error "The `projectSettings` object is required for new projects, but is missing in the deployment payload" HOT 3
- X-Vercel-IP-Country returning wrong country
- create a support case is disabled HOT 1
- [Deploy Button] integration installed callback is stuck HOT 1
- Issue Deploying Nuxt 2 App: Cannot find module 'vercel__launcher.launcher' HOT 7
- Latest NextJs build error HOT 1
- getInstalledPackageVersion is not a function HOT 3
- [email protected]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vercel.