score:0
score:4
1- react project will work normally on linux hosting?
yes, it will work in all webservers, unless you have server side rendering (ssr)
2- i need to all my project upload to ftp? because there is arround 20.000 file in node_modules directory.
files in node_modules will not go to your web server. these are development dependency files used only during development.
- run npm run build
- this will create a folder called
build
in project root. this will have all html, css , images and js files - copy all files and folders in
build
folder to your site root.
if your site has to be hosted in a sub folder in root you need to do the below, otherwise you will see a blank page. this is because your static files (css, js etc) are not loaded correctly.
open package.json
add a new entry homepage: /your_subfolder/
it will look like this
now do steps mentioned above and your site should work fine
score:8
create-react-app has a command to bundle your app to a ready to deploy state.
npm run build
this command will bundle your app in /build
folder. with the contents of this folder you can deploy your app in any hosting environment. you don't need to install your packages and libraries manually when you use this command. more information about using this command and deploying your app in different hosting environments can be found create-react-app readme
deployment
npm run build
creates abuild
directory with a production build of your app. set up your favorite http server so that a visitor to your site is servedindex.html
, and requests to static paths like/static/js/main.<hash>.js
are served with the contents of the/static/js/main.<hash>.js
file.
score:30
with this command build your app :
npm run build
build folder has created in your project directory, open index.html in your browser and check output...
if you saw a blank page (after build and opening index.html) , you must change the main js file path in the index.html :
default is : src="/static/js/main.ddfa624a.js"
change to : src="./static/js/main.ddfa624a.js"
i changed js path and this worked !
Source: stackoverflow.com
Related Query
- How upload reactjs project to ftp?
- How can I change ReactJS Project (folder) name?
- How to read and upload a file in reactjs using custom button
- How to upload image using ReactJS and save into local storage?
- How to Upload Multiple Image Files in a Single Call in Reactjs
- How to upload files from ReactJS to Express endpoint
- How to load gltf Model in Babylonjs Reactjs project
- how to set url in another input after upload file in reactjs
- Reactjs Nodejs file upload ftp via axios
- how to import custom css to reactjs project
- How to initialise mock service worker (msw) with reactjs project
- How to disable prettier errors in reactjs project and also no-unsued-vars error
- How to deploy react project to ftp using Bitbucket Pipelines?
- ReactJs - Axios - How to get multipart file upload progress
- How to implement the fetching of data for different categories of products to be shown in a home page using firebase on a Reactjs project
- How to make HTTP request to upload file from reactjs to google drive?
- How can i get my ReactJS project to display Unity 3D Game? I've tried react unity WEBGL
- How to stop sliding on last image of slider in carousel in bootstrap 5 on a reactjs project
- How to upload images into database using reactjs and php?
- How to start ReactJS project in ABP template?
- Index.html is missing while generating reactjs build. How can we deploy react and nodejs project to production?
- How to solve Unexpected token error in project with ReactJs and frontend-maven-plugin?
- How can I build a java backend and reactjs frontend project that is split up by features or modules
- ReactJS + Redux: How to use Mozilla File API to select local image and upload it to web?
- how to upload a folder in reactjs
- How can I upload multiple images in firebase v9 cloud storage using reactjs
- How to import a script for my project ? ReactJS
- How to upload images file in firebase in reactjs in newest update
- How to upload image file using ReactJS to api using NestJS with bytea datatype
- NextJS, how to upload a server-side rendered application to my FTP account
More Query from same tag
- File seperation in Three.js using React Classes
- React-router v4 route on click Button
- Real URLS with Single Page Applications?
- Strange behavior on state
- FirebaseError: "projectId" not provided in firebase.initializeApp
- Warning in ReactJs: Each child in an array or iterator should have a unique "key" prop
- How can I check a click on a child component using jest, if the callback isn't passed as prop?
- Why doesn't my Hello World work in react?
- React js reset state of a component if the parent component has re-rendered
- Safely access a property inside a nested javascript object
- Try to connect Action with Reducer but get Error: Uncaught (in promise) TypeError: dispatch is not a function
- Unable to call child function from parent using refs with functional component
- Render HTML inside a React app using iframe
- Storing JS variable before react js loaded
- Routes are not working "template does not exist"
- React Material UI SelectField menu items not appearing
- React material-ui (MUI) 5 conditional CSS classes
- Map input array and get filtered array of object as result
- axios post request from frontend not recieving in node js backend
- How can I dynamically generate a PrivateRoute redirect based on an axios response?
- How to implement media query in React.js for full background image?
- Integrating Polymer Web Components into React app written in Typescript?
- Why is my Reactjs app URI showing the a replacement for :
- react - accessing DOM without breaking encapsulation
- How to stop child components resetting on parent setState
- React.js: Get values as string from a state array
- What is the purpose of using JSON.stringify()?
- React-URLSearchParams returning Null object
- Handling 413 (Request Entity Too Large) error with try/catch
- Unable to read prop in a React functional component passed via Redux