salomonsky commited on
Commit
13fe682
·
verified ·
1 Parent(s): 27dd1a5

Update server.mjs

Browse files
Files changed (1) hide show
  1. server.mjs +10 -0
server.mjs CHANGED
@@ -19,8 +19,18 @@ if (fs.existsSync(distPath)) {
19
  console.error(`❌ ERROR CRÍTICO: No se encuentra la carpeta 'dist'. Vite no construyó la app.`);
20
  }
21
 
 
 
 
 
 
 
 
 
 
22
  app.use(express.static(distPath));
23
 
 
24
  app.get('*', (req, res) => {
25
  const indexPath = path.join(distPath, 'index.html');
26
  if (fs.existsSync(indexPath)) {
 
19
  console.error(`❌ ERROR CRÍTICO: No se encuentra la carpeta 'dist'. Vite no construyó la app.`);
20
  }
21
 
22
+ // 🛑 PARCHE CRÍTICO: Sobreescribe el MIME Type para los archivos .jsx
23
+ app.use((req, res, next) => {
24
+ if (req.url.endsWith('.jsx')) {
25
+ res.type('application/javascript');
26
+ }
27
+ next();
28
+ });
29
+
30
+ // Servir archivos estáticos (Ahora incluye la regla del .jsx)
31
  app.use(express.static(distPath));
32
 
33
+ // Manejar SPA
34
  app.get('*', (req, res) => {
35
  const indexPath = path.join(distPath, 'index.html');
36
  if (fs.existsSync(indexPath)) {