score:1
I've made a new repository but I still want to serve the create-react-app
with express so I've followed this tutorial and created a /client
folder in my project and put there all the create-react-app
files and folders together with its package.json
.
The scripts I use to deploy or lunch in dev mode are the following:
"client": "cd client && yarn start",
"server": "nodemon server.js",
"dev": "concurrently --kill-others-on-fail \"yarn server\" \"yarn client\"",
"build": "yarn && cd client && yarn && yarn build && cd ../",
"deploy": "git pull origin master && yarn build && pm2 restart server.js || pm2 start server.js"
I'd like to know which are the cons of this approach if someone has any experience.
score:0
First, eject your create-react-app project like this :
npm run eject
or yarn eject
Second, you can configure index.html
and public folder
path from: [react-project-dir]/config/paths.js
In your case i assume eject
command will create a folder in root directory of your project so you can find it in: [project-dir]/config/paths.js
You can change these parameters:
...
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
like this:
appPublic: resolveApp('public_react'),
appHtml: resolveApp('public_react/index.html'),
Source: stackoverflow.com
Related Query
- Add Service Worker to Create React App Project
- How to add TypeScript 3.7 Optional Chaining support to create react app project
- add third-party js library to Create React App
- Can I serve a create react app from an express server without running 'npm run build'?
- Add create-react-app as frontend in express project
- How to add express backend to existing react app
- Add craco webpack plugin by condition for create react app
- React SSR(Server Side Rendering) for SEO before login and after login Create React App (CRA). How to do this in one project folder?
- Create React App not reloading with Express in development
- Facebook Create React App Build - Add Image As Prop Type
- My React 18 app does not reload automatically I try to click on the create new project button does not work unless I refresh the page manually
- How do I add WebPack polyfill to React App created with React Create App without ejecting?
- Unable to display photo in react create app project
- Create React App proxy to express server for PassportJS not working
- I am using socketio with react as the frontend and node with express js to make an app
- Add path when webpack creates static asset files react, create react app
- unable to add classes in react using create react app
- How can I add Vanilla JS to my react app to create Image Modal pop-ups?
- How to add react to an existing express multipage project with ejs?
- express * all routes never runs with create react app when using app.use(express.static)
- How to programmatically add a className and a onLoad function to all the images in the project at once in React app without Jqyery
- create react app with express on azure app service fails to start
- how to deploy a create react app with express on heroku?
- blank page after of making project by create react app
- CSS modules in Create React App project aren't working properly
- How to get data from backend express server to frontend react app and vice versa
- Adding a second html page in a Create React App project
- how to add rules to ESLint in Create React App
- Express session - Add and access custom cookie field outside of req in a react app
- create react app not picking up .env files?
More Query from same tag
- Algolia InstantSearch default Parameters / Scope
- Child to trigger parent function with parameters
- Axios POST does not recognize the data being passed in from react
- Deploy Action when Reducer Field is Null
- React Hook useMemo has missing dependencies
- What is the correct way to correctly visualize a component React in top of another?
- Local persistent storage
- Align Menu.Item to bottom inside a Sider
- How to pass just a component's function to another component without rendering it
- customizing the expansionpanel in material ui and overwriting the styles
- React new HOOKS api, useReducer with dynamic initialState
- How to get the id rather than labelKey from typeahead when an array of objects is passed through?
- react - is styling with use of method is a good practice
- Rendering multiple videos in React
- Cannot extract data from post request in node
- How to combine different input values (+react, typescript)
- Type 'undefined' must have a '[Symbol.iterator]()' method that returns an iterator
- How do I map data from state to component prop?
- How to render the CloseIcon only when the image is inserted?
- How to wrap a part of text fetched from array of object in a span tag?
- React with Typescript: Types for array.map() with arrow function
- How install a Bootswatch theme on React project?
- Antd V4 form list setFieldValue
- JavaScript change time format
- How can I show/hide mobile navbar on click using useState? React + TypeScript + Tailwind project
- State variable is not updated in onClickHandler while using Hooks for getting data from an API by a user input in react
- i have array inside usestate and i changed value from function but dosnt work - react native hooks
- "Key" from Object.keys does not return true in comparaison with identical string
- JS: shorten search results by the words, which were found
- Unable to run react js project