Next.js Discord

Discord Forum

Build Error - TypeError: (intermediate value).default is not a function at c.metadata.icon

Unanswered
Great Horned Owl posted this in #help-forum
Open in Discord
Great Horned OwlOP
Getting this error when I'm trying to npm run build my Next 15.01 app.

And I'm completely clueless on how to go about fixing it.

This is what my layout.tsx looks like:

https://pastebin.com/xbJLe4aK

Error:
Error occurred prerendering page "/". 
Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: (intermediate value).default is not a function
    at c.metadata.icon (D:\Web Projects\DesignDir\designdir-next\.next\server\app\page.js:1:1926)
    at async D:\Web Projects\DesignDir\designdir-next\.next\server\chunks\93.js:2:48266
    at async Promise.all (index 0)    
    at async v (D:\Web Projects\DesignDir\designdir-next\.next\server\chunks\93.js:2:48322)
    at async Promise.all (index 0)    
    at async w (D:\Web Projects\DesignDir\designdir-next\.next\server\chunks\93.js:2:48438)
    at async E (D:\Web Projects\DesignDir\designdir-next\.next\server\chunks\93.js:2:49432)
Export encountered an error on /page: 
/, exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null

4 Replies

Great Horned OwlOP
@gin

Thanks for the reply - I did try this too, I even tried not using an icon at all, and it still shows the same issue..
Great Horned OwlOP
Update, I was able to fix the issue - so I had this in my next.config:

 webpack: (config: any) => {
    config.module.rules.push({
      test: /\.ico$/,
      type: 'asset/resource',
      generator: {
        filename: 'static/[hash][ext]',
      },
    });
    return config;
  },


Removing it fixed the issue.