nuxt / nuxt/module-builder

auto import failing when using my module deployed on npm

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

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
275
Forks
35
Avg merge
4h 42m
Merged PRs (30d)
6

Description

Hi,

I've created a custom module that has a few composeables.
When I use the module installed via npmjs I get errors of undefined on pretty much all nuxt utilities (useRuntimeConfig, defineNuxtPlugin etc).
When I use the module locally with link it works fine.

Doesn't seem to be a build/package problem; I get no errors if I use explicit imports in the module composeables

Using:

  • node v22.19.0
  • nuxt 4.1 (same happens on 3.17)
  • pnpm (same problem with yarn)

Any idea why this might happen, how to troubleshoot ? I'll gladly submit a fix, just somewhat new to nuxt modules and need a bit of guidance on where to start ...

Thank you,
Rares

Contributor guide

Open the contributing guide

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

Reproduce the failure with the module installed from npm, then compare it with the locally linked version using Nuxt 4.1 and 3.17. Start by checking the composeables that use useRuntimeConfig and defineNuxtPlugin, and compare them with the explicit-import behavior; done means those Nuxt utilities work without explicit imports in the published package.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.