React: Difference between revisions
From DiviFree
No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
* https://stackoverflow.com/questions/57090744/how-do-i-configure-my-htaccess-file-for-react-app-in-subdirectory | * https://stackoverflow.com/questions/57090744/how-do-i-configure-my-htaccess-file-for-react-app-in-subdirectory | ||
Build the project ( | Start the projet | ||
<pre> | |||
npm start | |||
</pre> | |||
Build the project (to deploy) | |||
<pre> | <pre> | ||
npm run build | npm run build | ||
Latest revision as of 18:46, 28 March 2023
Déployer un app react
- https://create-react-app.dev/docs/deployment/
- https://stackoverflow.com/questions/57090744/how-do-i-configure-my-htaccess-file-for-react-app-in-subdirectory
Start the projet
npm start
Build the project (to deploy)
npm run build
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
Erreur
'react-scripts' n’est pas reconnu en tant que commande interne
npm install react-scripts --save