Next.js Discord

Discord Forum

Npm run dev production alternative

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
Hello! I want to use velite for my website to support markdown, but when I build my project it doesn't listen for files in the specified directory, so it doesn't update them dynamically. I want dynamic update of the markdown files (they should be available immediately). And npm run dev shows many error and development-specific information that's totally unacceptable fro production use. Is there any way to run it dynamically without npm run dev?

31 Replies

Brown bearOP
@Anay-208 | Ping in replies
Brown bearOP
Yes
And I'm looking whether there's a way to start it dynamically
Like I don't want velite compiling my code
Brown bearOP
I want to add markdown dynamically, which works only in dev
@Anay-208 | Ping in replies https://velite.js.org/guide/with-nextjs
Brown bearOP
I've read it
Wait, you want to update it dynamically when the file changes?
In some directory I want to add, update, delete
You have to rebuild the app then, or use a CMS otherwise
Brown bearOP
And I want this changes to be reflected immediately
use a CMS
Brown bearOP
Hmm...
like sanity, payload
Brown bearOP
I dunno
I can build one myself maybe
The problem is dynamic compilation of markdown into html
Velite does this out of the box in dev
I can make some API which will do it
But this means that I also need to write conversion logic myself
@Anay-208 | Ping in replies like sanity, payload
Brown bearOP
Also in velite I use custom styles for MDX
So I can directly write html/css/js inside markdown
Also this custom styles helped me with browser-related inconsistencies
And on top of it I use velite to detect markdown pages and make a preview of them
So moving it to CMS and also ditching velite will be painful
So you can't dynamically update it unless you rebuild the app
@Brown bear And that's a problem
For this type of usecase, I built a custom CMS with tiptap editor(Its a rich text, but you might find some markdown editors too.