Skip to content
Discussion options

You must be logged in to vote

ChatGPT suggested the following:

What’s biting you here is dynamic imports that use a path alias inside a template string when they live outside the app/ tree.

I moved my utility helper to ./src/app/lib/markdown.ts, and that still didn't work, so I moved it back to ./src/lib/markdown.ts.

ChatGPT also suggested replacing the aliased import path with a relative path, so I gave that a whirl:

// ./src/lib/markdown.ts

import React from "react";
import dynamic from "next/dynamic";

export async function getMarkdown(slug: string) {
  const {default: Markdown} = await import(`../../content/${slug}.mdx`)
  return Markdown as React.ComponentType
}

export function getMarkdownDynamic(slug: string) {

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
3 replies
@jcarlson
Comment options

@icyJoseph
Comment options

@jcarlson
Comment options

Comment options

You must be logged in to vote
6 replies
@jcarlson
Comment options

@icyJoseph
Comment options

@icyJoseph
Comment options

@jcarlson
Comment options

@jcarlson
Comment options

Answer selected by jcarlson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants