nuxt / nuxt/module-builder

RollupError in Nuxt 4 module.

Open
#665 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment

  • Operating System: Windows_NT
  • Node Version: v24.7.0
  • Nuxt Version: 4.1.1
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.5
  • Package Manager: npm@11.4.1
  • Builder: -
  • User Config: modules, build
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Im trying to update my module (https://github.com/Pentadome/nuxt-openAPI-wrapper/tree/nuxt-4) to Nuxt 4. but after updating, whenever i build the playground, i get this rollup error:

(node:456) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern mapping "./" in the "exports" field module resolution of the package at C:\Users\user\repos\nuxt-open-api\nuxt-openapi-wrapper\playground\node_modules\@vue\shared\package.json imported from C:\Users\user\repos\nuxt-open-api\nuxt-openapi-wrapper\playground\node_modules\nuxt\dist\core\runtime\nitro\templates\error-dev.js. Mapping specifiers ending in "/" is no longer supported.
(Use `node --trace-deprecation ...` to show where the warning was created)
[plugin inject] playground/node_modules/.cache/nuxt/.nuxt/openapi-wrapper/index.ts: rollup-plugin-inject: failed to parse C:/Users/user/repos/nuxt-open-api/nuxt-openapi-wrapper/playground/node_modules/.cache/nuxt/.nuxt/openapi-wrapper/index.ts. Consider restricting the plugin to particular files via options.include

 ERROR  RollupError: playground/node_modules/.cache/nuxt/.nuxt/openapi-wrapper/index.ts (1:7): Expected '{', got 'type' (Note that you need plugins to import files that are not JavaScript)                                             nitro 15:44:33  


1: export type * from "C:/Users/user/repos/nuxt-open-api/nuxt-openapi-wrapper/dist/runtime/fetchTypes";
Describe the bug

I did not get this error when building for Nuxt 3.

Additional context

No response

Logs

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

Start by reproducing the Nuxt 4 build in the linked nuxt-openAPI-wrapper playground and inspect the generated .nuxt/openapi-wrapper/index.ts entry point. Read the rollup-plugin-inject failure and compare the Nuxt 3 and Nuxt 4 build paths. Done means the playground build completes without the reported RollupError.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rollup, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.