umami-software / umami-software/api-client

Cannot get started in Nuxt 3

Open
#20 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
47
Forks
18
PR merge metrics
No merged PRs in 30d

Description

I was trying to use @umami/api-client in my application built with Nuxt 3 but I cannot even get started with getClient. The page won't load correctly if I called getClient somewhere. Deleting the calls will bring the page back.

What Nuxt gave me after I added the getClient call and reloaded the page:

Cannot find module 'react'
Require stack:
- node_modules/.store/next-basics@0.36.0/node_modules/next-basics/dist/cjs/index.js
- node_modules/.store/@umami+api-client@0.77.0/node_modules/@umami/api-client/dist/cjs/index.js"
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:15)
at Function._load (node:internal/modules/cjs/loader:1051:27)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (./node_modules/.store/next-basics@0.36.0/node_modules/next-basics/dist/cjs/index.js:1:75)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Object..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Function._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)

I can't figured out why it's related to React, and the problem won't go away even if I installed react@latest as dependency (this sounds not right though). The Requirements in the doc only points out that >= 18.18 Node.js environment should be present. I didn't seem to find anything to do with React.

Anybody can help?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Nuxt 3 failure with getClient and inspect @umami/api-client/dist/cjs/index.js and its next-basics require stack. Compare the behavior with the API client requirements documentation; done means a Nuxt 3 page can load with getClient without requiring React or an undocumented dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, react, typescript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.