Skip to content

Instantly share code, notes, and snippets.

@darnocer
Created July 26, 2023 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darnocer/ee57f1b59a9dca4d009d4fe34811dc0d to your computer and use it in GitHub Desktop.
Save darnocer/ee57f1b59a9dca4d009d4fe34811dc0d to your computer and use it in GitHub Desktop.
'builtin-modules' error

Error

./node_modules/@esbuild-plugins/node-resolve/esm/index.js:37:0
Module not found: Can't resolve 'builtin-modules'

Import trace for requested module:
./node_modules/mdx-bundler/dist/index.js
./lib/mdx.js
./pages/index.js

Solution

Related to mdx-bundler.

Solutions in this issue thread did not work for me.

Realized it was due to importing the incorrect service in the import statement.

import { getAllFilesWithType } from '@/lib/mdx' // Needed to update to getAllFilesFrontMatter


export async function getStaticProps() {
  const posts = await getAllFilesFrontMatter('blog')

  return { props: { posts } }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment