React: Difference between revisions

From DiviFree
(Created page with "==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 Build the project ( <pre> npm run build </pre> .htaccess <pre> <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 ....")
 
No edit summary
Line 19: Line 19:
RewriteRule . /index.html [L]
RewriteRule . /index.html [L]
</IfModule>
</IfModule>
</pre>
==Erreur==
'react-scripts' n’est pas reconnu en tant que commande interne
<pre>
npm install react-scripts --save
</pre>
</pre>

Revision as of 18:43, 28 March 2023

Déployer un app react

Build the project (

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