Aller au contenu principal
ProduitsOutils de bureauTASTECADConsultation de plansTASTEFILESGestion de fichiersTASTEFTPTransfert de fichiersTASTESSHEspace de travail à distanceTASTEZIPCompression et extractionOutils pour développeursTASTECODEEnvironnement de développement intégré pour RustTASTESTUDIOEnvironnement intégré de développement et de testTASTEETLIntégration de données (ETL)ServeursTASTEREMOTEServeur de bureau à distanceTASTEGEOServeur géospatialTASTEMAILEspace de travail e-mailCommencerTéléchargementsDocumentationAcheterTous les produits
Marketplace
Actualités
TechActualitésL’actu dev du jourDocs développeursLangages de programmationRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks front-end webNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks serveurSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks d'applications et de bureauTauriFlutterReact NativeElectronAlgorithmesBases des algorithmesAlgorithmes essentielsAlgorithmes avancésAlgorithmes pratiques
CommunautéProjetsJournaux de développementPromptsProblèmes d’outils d’IAVitrineGuide de la communauté
CollaborerTransfert techniqueRéalisation de site webRéalisation d'application de bureauChaîne de publication et de paiementPartenaire commercialContact
ServicesBureau à distancePaquets d'installation sur mesure
TASTEDEV
Produits

Outils de bureau

TASTECADDes plans complexes, ouverts en toute légèretéTASTEFILESSeulement les fichiers utiles, au plus viteTASTEFTPLe chemin le plus net pour vos fichiersTASTESSHEntre vos serveurs et vous, un lien plus solideTASTEZIPCompresser plus vite, extraire en toute sécurité

Outils pour développeurs

TASTECODEModifier, compiler, déboguer et tester vos apps Rust dans une seule fenêtreTASTESTUDIODe l’édition aux tests à distance et aux corrections IA approuvéesTASTEETLDéplacer les données, les valeurs sous les yeux

Serveurs

TASTEREMOTEUn bureau à distance hébergé sur votre propre serveurTASTEGEOUn serveur géospatial compatible GeoServer, reconstruit en RustTASTEMAILReprenez la maîtrise de vos e-mails

Commencer

TéléchargementsDernières versions de chaque produitDocsUtiliser chaque produitAcheterAbonnements et licences perpétuellesTous les produitsTous les produits en un coup d’œil
Tous les produits
MarketplaceActualités
Tech

Actualités

L’actu dev du jourAnnonces officielles : langages, frameworks, GitHub et IADocs développeursGuides des langages, frameworks et algorithmes

Langages de programmation

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks front-end webNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks serveurSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks d'applications et de bureauTauriFlutterReact NativeElectron

Algorithmes

Bases des algorithmesAnalyse de complexité · Tri · Recherche · Structures de données de base · Arbres et tasAlgorithmes essentielsParcours de graphe · Plus courts chemins et arbres couvrants · Programmation dynamique · Algorithmes gloutons · Diviser pour régner · Backtracking (retour sur trace)Algorithmes avancésAlgorithmes sur les chaînes · Mathématiques et théorie des nombres · Manipulation de bits · Arbres de segments · Union-FindAlgorithmes pratiquesStratégie pour les entretiens de codage · Cache LRU · Limitation de débit · Hachage cohérent
Toute la documentation de développement
Communauté
ProjetsDécouvrir les créateurs et leurs travauxJournaux de développementDécisions et enseignementsPromptsInstructions réutilisablesProblèmes d’outils d’IAProblèmes et contournements de Claude, Codex, GeminiVitrineRéalisations terminéesGuide de la communautéConstruire en toute transparence
Collaborer
Transfert techniqueApplications natives en Rust et eguiRéalisation de site web10 langues, comptes, documentation et téléchargementsRéalisation d'application de bureauRust et egui, sans WebViewChaîne de publication et de paiementSignature, MSI, deb, rpm, AppImage, empreintesPartenaire commercialRecommandez-nous, touchez 30 %ContactDéveloppement, partenariats, investissement
Services
Bureau à distanceAccédez à votre ordinateur depuis le navigateurPaquets d'installation sur mesureSeulement l'utile, réglages préchargés
Acheter
FR
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Se connecter
Se connecter
TASTEDEV

Des petits outils à un meilleur développement.

support@tastedev.netSoutenir TASTEDEV
ProduitsGamme de produitsAcheterDocsTéléchargementsMarketplaceAssistance
CommunautéProjetsJournaux de développementPromptsProblèmes d’outils d’IAVitrine
RèglesPolitique de confidentialitéConditions d'utilisationConditions d’abonnementRemboursementRègles de la communauté
CompteSe connecterS'inscrire
Visiteurs
Aujourd’hui
012345678901234567890123456789012345678901234567890123456789
Hier
012345678901234567890123456789012345678901234567890123456789
Vues au total
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
Société
GXSOFT
Représentant
CHOI YOUNG GU
Numéro d’enregistrement
853-44-00368
Adresse
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Téléphone
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsable de la confidentialité
CHOI YOUNG GU

© 2026 TASTEDEVLes informations produit s'appuient sur des sources de développement vérifiées.Publié · en amélioration

Documentation React
React
Getting Started with ReactProject StructureCore ConceptsData and StateTestingBuild and Deployment
Discussions

Guide React · 6/6

Build and Deployment

Ce chapitre n'est disponible qu'en anglais pour le moment.

A React app built with Vite compiles down to static HTML, JavaScript and CSS files. That means you can serve it from static hosting, a CDN or a web server such as nginx without running Node.js in production. This chapter covers the production build, hosting configuration and container deployment.

Production build

npm run build     # type-check with tsc -b, then vite build
npm run preview   # serve dist locally at http://localhost:4173

The build writes a dist/ folder. Code is minified, unused code is removed, and file names under dist/assets/ include a hash derived from their contents.

dist/
├── index.html
├── vite.svg
└── assets/
    ├── index-B1c2D3e4.js
    └── index-F5g6H7i8.css

npm run preview is only for checking the build output; it is not meant to be a production server. Before deploying, use it to confirm the app behaves correctly without the development-only StrictMode double invocation.

Per-environment settings and sub-paths

Builds use the values from .env.production, and --mode selects a different env file. If the app is not served from the domain root, for example GitHub Pages at https://user.github.io/repo/, set base so asset URLs are generated correctly.

# build using .env.staging
npx vite build --mode staging
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  base: "/my-app/",
});

Environment variables starting with VITE_ end up as plain strings in the bundle, readable by anyone. Keep secret keys out of the frontend and handle them in a backend or serverless function.

SPA routing and fallbacks

With a client-side router such as React Router, opening or refreshing a URL like /users/42 asks the server for a file that does not exist, and it responds with 404. Configure your host to return index.html for every path that does not match a static file.

On Netlify, a public/_redirects file is copied into the build output as-is:

/*    /index.html   200

On Vercel, add a rewrite rule to vercel.json at the project root:

{
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}

In nginx, try_files does the same job. Hashed files in assets/ change name whenever their content changes, so they can be cached for a long time, while index.html should not be cached so new deployments show up immediately.

Des questions sur ce chapitre ?
Chapitre précédentTesting
server {
  listen 80;
  root /usr/share/nginx/html;
  index index.html;

  location / {
    try_files $uri $uri/ /index.html;
    add_header Cache-Control "no-cache";
  }

  location /assets/ {
    add_header Cache-Control "public, max-age=31536000, immutable";
  }
}

Deploying with Docker

A multi-stage build compiles the app with Node.js and ships only the output in a small nginx image. Save the nginx configuration above as nginx.conf so it is copied in as well.

FROM node:lts-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
docker build -t my-app .
docker run --rm -p 8080:80 my-app

Listing node_modules and dist in .dockerignore keeps the build context small and the build fast.

Pre-deployment checklist

  • Make npm run lint and the tests (npx vitest run, npx playwright test) pass in CI.
  • Use npm run preview to check sub-paths, page refreshes and image URLs.
  • If the bundle is large, split code per screen with React.lazy and dynamic import().
  • When server rendering or SEO becomes important, consider moving to a framework such as Next.js.

Summary

  • npm run build produces static files in dist/, and npm run preview lets you check them.
  • Set base for sub-path deployments and an index.html fallback for client-side routing.
  • Cache hashed assets for a long time and index.html not at all.
  • A multi-stage Docker build packages the app in an nginx image you can run anywhere.

Official documentation

  • React documentation
  • Creating a React App
  • Build a React app from Scratch
  • Vite: Building for Production
  • Vite: Deploying a Static Site
  • Vite: Env Variables and Modes

0 commentaire

Meilleurs commentairesPlus récents d'abord

Se connecter · Connectez-vous pour laisser un commentaire.