Sources not working
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.15.1
- Nuxt Version:
3.0.0-rc.11
- Nitro Version:
0.5.4
- Package Manager:
yarn@1.22.17
- Builder:
vite
- User Config:
-
- Runtime Modules:
-
- Build Modules:
-
π Report an issue: https://github.com/nuxt/framework/issues/new 12:02:39
π Suggest an improvement: https://github.com/nuxt/framework/discussions/new
π Read documentation: https://v3.nuxtjs.org
Reproduction
https://github.com/stursby/nuxt-content-sources-bug
Describe the bug
Trying to get another sources folder called snippets
for code snippets. Canβt get it working.
I create a fresh Nuxt Content project with npx nuxi init nuxt-content-source-bug -t content
then added a snippets
folder in the root dir.
βββ README.md
βββ app.vue
βββ content
βΒ Β βββ about.md
βΒ Β βββ index.md
βββ nuxt.config.ts
βββ package.json
βββ pages
βΒ Β βββ [...slug].vue
βΒ Β βββ test.vue
βββ snippets
βΒ Β βββ hello.md
βββ tsconfig.json
βββ yarn.lock
I then tried multiple config options to load that directory, but getting the following error in iTerm.
import { resolve } from "path";
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: ["@nuxt/content"],
content: {
// Array w/ String doesn't work
// sources: ["snippets"],
// ...doesn't work either
sources: [
"snippets",
{
name: "snippets",
driver: "fs",
base: resolve(__dirname, "snippets"), // Path for source directory
},
],
},
});
For example, I created a test page and tried to pull in that snippet.
Nuxi 3.0.0-rc.11 12:04:59
Nuxt 3.0.0-rc.11 with Nitro 0.5.4 12:04:59
12:05:01
> Local: http://localhost:3000/
> Network: http://10.0.0.196:3000/
> Network: http://[2601:445:500:1200:610c:38e7:e249:e1e8]:3000/
> Network: http://[2601:445:500:1200:8da:1a0f:e880:45e4]:3000/
> Network: http://[2601:445:500:1200::ab06]:3000/
βΉ Cleaning up generated nuxt files and caches... 12:05:01
ERROR Cannot start nuxt: Cannot find package 'undefined' imported from /Users/hield/Sites/__SCRAP__/nuxt-content-source-bug/node_modules/nitropack/dist/shared/nitro.9c828268.mjs
at new NodeError (node:internal/errors:372:5)
at packageResolve (node:internal/modules/esm/resolve:954:9)
at moduleResolve (node:internal/modules/esm/resolve:1003:20)
at defaultResolve (node:internal/modules/esm/resolve:1218:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
at ESMLoader.import (node:internal/modules/esm/loader:380:22)
at importModuleDynamically (node:internal/modules/esm/translators:106:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
at createStorage (node_modules/nitropack/dist/shared/nitro.9c828268.mjs:1189:69)
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7
Top GitHub Comments
@stursby i got exactly same error. i removed the string from array and that worked for me. try this:
@ROBJkE yes, thanks, created a new issue for that.