Closed qiushiyan closed 1 year ago
Yes, having the same problem. Downgrading to 13.2.4 works, assuming you overwrote telemetry dependency as described here.
Same problem, but downgrading to 13.2.4 will encounter other next problems, can anyone provide some help?
I have found the cause of this problem.
Since next@v13.2.5-canary.27
, next dev has been using jest-worker to start the service.
Using a version below next@v13.2.5-canary.26
will not have this problem.
Of course, the best solution is to optimize the way of next config plugin.
what triggers the creation of .contentlayer
folder? I have degraded my nextjs version to 13.2.4
from 13.3.0
but the folder is still not getting generated.
// next.config.js
/** @type {import('next').NextConfig} */
const { withContentlayer } = require("next-contentlayer");
const nextConfig = {
reactStrictMode: true,
distDir: "build",
experimental: {
appDir: true,
},
};
module.exports = withContentlayer(nextConfig);
Just saw this issue. My contentlayer is working fine (check: harshhhdev/www), but it's because I'm using 0.3.0
instead of 0.3.1
.
Is this a bug with Next 13.3 or is it a bug with contentlayer?
Is this a bug with Next 13.3 or is it a bug with contentlayer?
It's just a matter of how the plugin is started
I too have the same issue, here's my package.json
"next": "13.3.0",
"next-contentlayer": "^0.3.0",
"contentlayer": "^0.3.0",
also tried downgrading the versions just like the contentlayer-example still the issue persist.
work fine with these configs( see my forked example ):
"next": "13.2.4",
"next-contentlayer": "0.3.1",
"contentlayer": "0.3.1"
@qiwang97 these are same versions used in contentlayer-example, but still it doesn't work.
"contentlayer": "^0.3.0",
"next": "13.2.5-canary.16",
"next-contentlayer": "^0.3.0",
I used the above example from leerob's portfolio repository and it works fine.
Until this is resolved, you can either use concurrently to work around this:
{
// ---
"scripts": {
"dev": "concurrently \"contentlayer dev\" \"next dev\"",
"build": "contentlayer build && next build"
}
/ ---
}
Or have 2 different scripts for development and run them both in different tabs:
{
// ---
"scripts": {
"cl-dev": "contentlayer dev",
"dev": "next dev",
"build": "contentlayer build && next build"
}
/ ---
}
Local fix until this issue is resolved. You can update the dev script in package.json and make use of the content layer cli as follows:
"scripts": {
"dev": "contentlayer dev & next dev"
}
then run
pnpm dev
Content layer cli - https://www.contentlayer.dev/docs/reference/cli#dev
@qiwang97 these are same versions used in contentlayer-example, but still it doesn't work.
"contentlayer": "^0.3.0", "next": "13.2.5-canary.16", "next-contentlayer": "^0.3.0",
I used the above example from leerob's portfolio repository and it works fine.
Thank you! This versions are working for meπ
Alterly, you can try npx contentlayer dev
, it also generates the .contentlayer
folder.
@qiwang97 these are same versions used in contentlayer-example, but still it doesn't work.
"contentlayer": "^0.3.0", "next": "13.2.5-canary.16", "next-contentlayer": "^0.3.0",
I used the above example from leerob's portfolio repository and it works fine.
Thank you! This versions are working for meπ
Alterly, you can try
npx contentlayer dev
, it also generates the.contentlayer
folder.
In order to generate the .contentlayer/generated
folder, you will need to run npx contentlayer postinstall
as well. I don't know why that isn't being run when I run npx contentlayer dev
or npx contentlayer build
though. :shrug:
EDIT: Using the following from my package.json
:
"contentlayer": "0.3.1",
"next": "13.3.0",
"next-contentlayer": "0.3.1",
Local fix until this issue is resolved. You can update the dev script in package.json and make use of the content layer cli as follows:
"scripts": { "dev": "contentlayer dev & next dev" }
then run
pnpm dev
Content layer cli - https://www.contentlayer.dev/docs/reference/cli#dev
This worked for me as well.
Local fix until this issue is resolved. You can update the dev script in package.json and make use of the content layer cli as follows:
"scripts": { "dev": "contentlayer dev & next dev" }
then run
pnpm dev
Content layer cli - contentlayer.dev/docs/reference/cli#dev
Little side note: Due to how &
works, contentlayer dev & next dev
runs concurrently on macOS and Linux, but for example, runs sequentially in PowerShell. So if you need consistency for this edge case, you may want to go with concurrently \"contentlayer dev\" \"next dev\"
.
This should be addressed with the 0.3.2
release. π
im not sure, as to open a new issue for this but the problem was the same as mentioned though here's a catch, i was able to generate the .contentlayer
folder but now my app's stuck here, i don't see anything at post 3000, it just loads infinitely.
Any help appreciated!
here's my next.config.js
const { withContentlayer } = require('next-contentlayer')
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export',
images: {
unoptimized: true,
},
}
module.exports = withContentlayer(nextConfig)
and my contentlayer.config.ts
import { defineDocumentType, makeSource } from '@contentlayer/source-files'
export const Post = defineDocumentType(() => ({
name: 'Post',
filePathPattern: `**/*.md`,
fields: {
title: { type: 'string', required: true },
date: { type: 'date', required: true },
},
computedFields: {
url: { type: 'string', resolve: (post) => `/posts/${post._raw.flattenedPath}` },
},
}))
export default makeSource({ contentDirPath: 'posts', documentTypes: [Post] })
and my packages
"contentlayer": "^0.3.3",
"date-fns": "^2.30.0",
"next": "13.4.4",
"next-contentlayer": "^0.3.3",
work fine with these configs( see my forked example ):
"next": "13.2.4", "next-contentlayer": "0.3.1", "contentlayer": "0.3.1"
It works. Thank you!
Also works with π
"contentlayer": "0.3.3",
"next": "13.3.0",
"next-contentlayer": "0.3.3"
Still having the same issue with versions 0.3.1
and 0.3.3
and the behaviour is quite flaky, as it worked and then suddenly stopped working so not sure exactly the reason behind it.
Still having the same issue with versions
0.3.1
and0.3.3
and the behaviour is quite flaky, as it worked and then suddenly stopped working so not sure exactly the reason behind it.
try removing the remark plugin from the contentlayer.config.js file, like this:
export default makeSource({
contentDirPath: './content',
documentTypes: [Post],
mdx: {
remarkPlugins: [remarkGfm], // only one, no more remark plugins
},
})
You aslo can look at the contentlayer.config.js and package.json in my project: https://github.com/weijunext/nextjs-learn-demos/tree/contentlayer
@weijunext remark is not even included. Should it be?
After investigation, I suspect that it has to do something with orphan processes staying in the background? Not entirely sure, but after closing iTerm, both iTerm, WebStorm and VSCode servers started working as expected π€
Reference also to here: https://github.com/shadcn-ui/taxonomy/issues/122
Simply going to cd apps/www/
and doing npm run build
generated the content layer generated folder for me
my only solution is put the .md files in data folder
data/posts/post-1.md
work on latest version of next.js
"dependencies": { "contentlayer": "^0.3.4", "next": "latest", "next-contentlayer": "^0.3.4", }
Seems contentlayer is currently imcompatible with the latest version of Next.js 13.3, when I run
next dev
non.contentlayer
folder is generated.I cloned the package.json, next.config.js and contentlayer config file from the example project and run the following comand to update nextjs
After this
pnpm run dev
does not generated the.contentlayer
folder.example repo