Skip to content

Content dir not working with layers #3307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
romi103 opened this issue Apr 11, 2025 · 3 comments · Fixed by #3308
Closed

Content dir not working with layers #3307

romi103 opened this issue Apr 11, 2025 · 3 comments · Fixed by #3308

Comments

@romi103
Copy link

romi103 commented Apr 11, 2025

Environment

  • Operating System: Windows_NT
  • Node Version: v22.14.0
  • Nuxt Version: 3.16.2
  • CLI Version: 3.24.1
  • Nitro Version: 2.11.8
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, extends, future, ssr, content
  • Runtime Modules: -
  • Build Modules: -

Version

3.4.0

Reproduction

https://stackblitz.com/edit/github-fhf1jy91

  1. Run 'npm install' from the 'app' and 'nuxt-layer' dirs
  2. from app run 'npm run dev'
  3. the index renders 'not found page'
  4. move the content dir from nuxt-layer to app
  5. the index renders the markdown

Description

When using Nuxt 3 layers, @nuxt/content does not work properly if it's configured inside a layer. The content module is correctly set up within the layer (including the content/ directory and configuration), but the content is not loaded or available in the consuming app.

However, if I move the content/ directory into the app that consumes the layer, everything works as expected.

This suggests that @nuxt/content does not correctly detect or process content from the extended layer.

@farnabaz
Copy link
Member

Thanks for the issue. This should be fixed in #3308. You can test with PR release

npm i https://pkg.pr.new/@nuxt/content@a5cf04e

Note: There is another issue with your reproduction. The app directory uses compatibilityVersion: 4, and the nuxt-layer does not use it. Both layers should share the same structure.

@larsrickert
Copy link

larsrickert commented May 2, 2025

@farnabaz Unfortunately this issue does not seem to be fixed :/

The issue is now the exact opposite:

  • version 3.4.0: content from app is loaded but not from layer
  • version 3.5.1: content from layer is loaded but not from app

I'd expect that both, the content fron the layer as well as from the app loaded

@ziadsarour
Copy link
Contributor

What worked for me to load content from app :

source: {
  cwd: path.resolve('content'),
  include: '**/*.md',
},

From layer it should be :

source: '**/*.md',

source field seems to be array compatible, so if you want both you might try :

source: ['**/*.md', {
  cwd: path.resolve('content'),
  include: '**/*.md',
}],

github-merge-queue bot pushed a commit to SchwarzIT/onyx that referenced this issue May 26, 2025
- fix Playwright version to 1.51.x to fix webkit issues with 1.52.0
- limit `@nuxt/content` module to version `< 3.5.0` since it has an
[existing issue](ttps://github.com/nuxt/content/issues/3307)

#3214 contains some approaches to try to fix the new issues that were
introduced with Playwright 1.52.0 because of the updated webkit version
but I haven't managed to fully get it working. So this PR contains all
updates/fixes except Playwright.

## Checklist

- [x] The added / edited code has been documented with
[JSDoc](https://jsdoc.app/about-getting-started)
- [x] A changeset is added with `npx changeset add` if your changes
should be released as npm package (because they affect the library
usage)
- [x] I have performed a self review of my code ("Files changed" tab in
the pull request)

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants