Skip to content

Unable to automatically determine the location of static site files. with new Next.js app #933

Answered by tannerdolby
hamirmahal asked this question in Q&A
Discussion options

You must be logged in to vote

@hamirmahal We have two options:

  1. Configure a custom server in lighthouserc.js to tell Lighthouse CI where the production-like assets from Next.js can be located
  2. Enable static exports in Next.js to create a build folder such as out which Lighthouse CI will automatically determine and use when running the CI GitHub Action

Custom Server

We need to tell Lighthouse CI where the "custom server" e.g. the Next.js application is serving the production-like assets. This can be handled by updating lighthouserc.js:

module.exports = {
  ci: {
    collect: {
      url: ['http://localhost:3000/'],
      startServerCommand: 'npm run start',
    },
    upload: {
      target: 'temporary-public-storage',

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@wigqueel
Comment options

@hamirmahal
Comment options

@hamirmahal
Comment options

@tannerdolby
Comment options

@hamirmahal
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by hamirmahal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants