Nextjs @Latest with Strapi not working - FRONTEND

System Information
  • Strapi Version: lastest
  • Operating System: MACOS
  • Database:
  • Node Version: latest
  • NPM Version: latest
  • Yarn Version: latest

Hello Guys, I getting this result with the a create react next with latest version @12+

Module parse failed: Unexpected token (8:33)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See webpackloaders
| * @returns {string} Full Strapi URL
| */

export function getStrapiURL(path: string = “”): string {
| return `${
| process.env?.NEXT_PUBLIC_STRAPI_API_URL || “http://localhost:1337

this is the tutorial that I’m following:

I’m doing a POC to use some for our enterprise to use a new CMS but seems that Strapi is not working properly

Any tips to solve that?

Are you writing JavaScript or TypeScript?

Your stack trace points to …/…/packages/domain/blog-strapi/api.js, so I assume you’re writing JavaScript.

So change from
export function getStrapiURL(path: string = “”): string {
export function getStrapiURL(path = “”) {

If you’re writing TypeScript, you probably need to change the file extension from .js to .ts and configure webpack to use the associated loader.

Also your quotes look fishy which might cause problems, too. Might come from the forum software, though. Change from “” to "";

It was a problem with the webpack, I resolved it by doing some changes in the next config.
thanks very much!