analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Error on build next.js 13 app with analytics

Open thigas88 opened this issue 11 months ago • 1 comments

Next.js 13 Analytics 1.4.1

yarn run build yarn run v1.22.22 $ next build

Get this error :

Collecting page data ..file:///node_modules/@vercel/analytics/dist/next/index.mjs:159
import { useParams, usePathname, useSearchParams } from "next/navigation.js";
         ^^^^^^^^^
SyntaxError: Named export 'useParams' not found. The requested module 'next/navigation.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'next/navigation.js';
const { useParams, usePathname, useSearchParams } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:146:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:229:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
file:///Users/thiago/Projetos/deliveryfoody-web/node_modules/@vercel/analytics/dist/next/index.mjs:159
import { useParams, usePathname, useSearchParams } from "next/navigation.js";

thigas88 avatar Nov 23 '24 12:11 thigas88