Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!