Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

323
Vistas
Got the error "Build optimization failed: found page without a React Component as default export in pages/" Help me

In developer mode worked great. Later in CMD, I sent "npm run build. Got error...

info  - Checking validity of types
info  - Creating an optimized production build
info  - Compiled successfully

> Build optimization failed: found pages without a React Component as default export in
pages/js/TimeClock
pages/js/ChangePage

I tried to fix it. Nothing on the internet helped. Here are my files:

index.js

import Head from 'next/head'
import Time from './js/TimeClock.page';
import { ChangePage0, ChangePage1, ChangePage2 } from './js/ChangePage.page';

export default function Home() {
  ...
}

TimeClock.page.js

import ReactDOM from 'react-dom'

export function tick()
{
    const site = (
        <div>
            <span className="time">
                {new Date().toLocaleTimeString()}
            </span>
        </div>
    );
    ReactDOM.render(site, document.getElementById('time'));
}
setInterval(tick, 1000);

next.config.js

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
}

module.exports = {
  pageExtensions: ['page.tsx', 'page.ts', 'page.jsx', 'page.js'], nextConfig
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Not sure to understrand what you're trying to do with the setIinterval on a component but you probably need to export default instead of a naming export.

In TimeClock.page.js

function Tick() {
   ...
}

export default Tick;
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda