Skip to content

Error on build next.js 13 app with analytics #161

@thigas88

Description

@thigas88

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";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions