"Hanging up"/No start with Next 13
See original GitHub issueSo I have been trying to debug this for the better part of a day, and I am a bit lost. I installed the lts Next (with the app directory) and the contentlayer dependencies (following the example on the site), and it seemed to work for a moment. However, when I reran “yarn dev”, I got the .contentlayer folder with only the cache and my terminal is stuck on the following screen:
I killed the command and reran yarn dev, but then I get:
Nothing seems to be generated (other than the contentlayer cache), and the site is unreachable.
my contentlayer.config.ts:
import { defineDocumentType, makeSource } from "contentlayer/source-files";
const Doc = defineDocumentType(() => ({
name: "Doc",
filePathPattern: "**/*.mdx",
contentType: "mdx",
fields: {
title: { type: "string", required: true },
description: { type: "string", required: true },
isPublished: { type: "boolean", required: true },
},
computedFields: {
url: {
type: "string",
resolve: (doc) => `/docs/${doc._raw.flattenedPath}`,
},
},
}));
export default makeSource({
contentDirPath: "content",
documentTypes: [Doc],
});
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@/styles/*": ["src/styles/*"],
"contentlayer/generated": ["./.contentlayer/generated"]
},
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
".contentlayer/generated"
],
"exclude": ["node_modules"]
}
I probably have missed something important, but for the life of me I can not get it working. I ran into the same issue when I cloned the example next demo as well on Nextjs 13.0.2 with contentlayer 0.2.9 on node 16.18.0 (on mac). I ditched the beta app structure and just went with src/* and a content folder at the root, but I ran into the same issue.
When it did run, it seemed to be very slow and took about a minute to finally get the dev server running. A fresh install sans contentlayer seemed to work just fine.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5
Top GitHub Comments
Well, I tried again this morning with the same results with yarn (1.22.19) and npm. However, when I loaded my example repo to Stackblitz it seems to work just fine.
Steps taken:
After some more poking around,
I have found that the “export default makeSource” is where it seems to be hanging up in my dev environment. If I comment it out next dev seems to proceed, but as soon as I set “contentDirPath” it completely hangs up after creating 2 files in the .contentlayer cache directory.Upon further inspection, it seems like there is an issue somewhere down the line with my actual terminal. I tried iterm, hyper, and the built in terminal to no avail. However, the vscode terminal is working just fine. Commence head bashing.
Yep! I appreciate the quick responses!