Giter Site home page Giter Site logo

Create React App about vercel HOT 12 CLOSED

vercel avatar vercel commented on May 11, 2024
Create React App

from vercel.

Comments (12)

fredrik-sogaard avatar fredrik-sogaard commented on May 11, 2024 3

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.

codyzu avatar codyzu commented on May 11, 2024 2

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.

  1. create your react app: create-react-app hello-world
  2. go into the created react app: cd hello-world
  3. build your react app for production: npm run build
  4. 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.

0xsven avatar 0xsven commented on May 11, 2024 2

@codyzu
This worked! Thank you.
now and react. Such a powerful combination.

from vercel.

dunnock avatar dunnock commented on May 11, 2024 1

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.

stephenhowells avatar stephenhowells commented on May 11, 2024 1

This comment seems like the best way to deploy CRA to Now: #160 (comment)

It essentially mimics what now-serve did.

from vercel.

OlliV avatar OlliV commented on May 11, 2024

Try this: https://github.com/xkawi/create-react-app-now

from vercel.

nonnontrivial avatar nonnontrivial commented on May 11, 2024

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.

0xsven avatar 0xsven commented on May 11, 2024

@kevmannn
I might be doing it wrong but ns build . or ns build are telling me: Specified path doesn't exist!

from vercel.

codyzu avatar codyzu commented on May 11, 2024

@0xsven great! Glad to read you got this worked out and I agree... now is real game changer!

Happy deployments!!!

from vercel.

stephenhowells avatar stephenhowells commented on May 11, 2024

According to Zeit, now-serve has been deprecated: https://zeit.co/blog/now-static

from vercel.

dangnelson avatar dangnelson commented on May 11, 2024

With now-serve being deprecated, I'm trying to use the now command and getting the cache error noted above.

from vercel.

jamo avatar jamo commented on May 11, 2024

The error sounds like it's starting the dev server after deployed...

from vercel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.