Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Running `dev:prepare` in the root of a module behaves differently than preparing in the playground

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

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
nuxt, typescript

Research direction

Start with the dev:prepare command and the @nuxt/module-builder prepare flow, then reproduce the failure using the linked nuxt-module-layers-repro project. Trace how the module setup function is first run and how nuxi prepare playground runs afterward. Done means preparing from the module root handles layer file discovery consistently with preparing in the playground.

Written by the indexing model from the issue text.

Description

@lewebsimple pointed out an edge case where, if a module checks for the existence of a certain file, running the dev:prepare script will fail when executed from the root of the module (via @nuxt/module-builder).

Reproduction
https://github.com/lewebsimple/nuxt-module-layers-repro

const rootDirs = getLayerDirectories().map(({ root }) => root)
let discoverMePath
for (const rootDir of rootDirs) {
  if (existsSync(`${rootDir}/discover-me.txt`)) {
    discoverMePath = `${rootDir}/discover-me.txt`
    logger.info(`Found discover-me.txt in layer: ${rootDir}`)
    break
  }
}
if (!discoverMePath) {
  throw new Error('Required file discover-me.txt not found in any layer directories.')
}

Steps to reproduce

  1. run pnpm dev:prepare in the root of the project
  2. see that it fails

Additional context

This happens because the module's setup function runs initially without taking the playground directory into account, and only afterward does it run separately for the playground.

"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
Dominant language
TypeScript
Stars
276
Forks
36
Avg merge
4h 16m
Merged PRs (30d)
6

Getting set up

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.

More from nuxt/module-builder

All issues in nuxt/module-builder

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.