question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing from `contentlayer/generated` in `contentlayer.config.ts` results in `ERR_PACKAGE_PATH_NOT_EXPORTED`

See original GitHub issue

Hi

I’m trying to update from contentlayer 0.0.34 to 0.1.2 and I’m facing this issue. I already did all the changes mentioned in the release notes

Thanks in advance

ConfigReadError {
  error: Error: Package subpath './generated' is not defined by "exports" in /Users/jahir/dev/jahir/website/node_modules/contentlayer/package.json imported from /Users/jahir/dev/jahir/website/.contentlayer/.cache/v0.1.2/compiled-contentlayer-config.mjs
      at new NodeError (node:internal/errors:371:5)
      at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
      at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
      at packageResolve (node:internal/modules/esm/resolve:873:14)
      at moduleResolve (node:internal/modules/esm/resolve:929:18)
      at defaultResolve (node:internal/modules/esm/resolve:1044:11)
      at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
      at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
      at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
      at link (node:internal/modules/esm/module_job:75:36) {
    code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
  },
  configPath: '/Users/jahir/dev/jahir/website/contentlayer.config.ts',
  _tag: 'ConfigReadError',
  toString: [Function (anonymous)],
  [Symbol()]: {
    error: Error: Package subpath './generated' is not defined by "exports" in /Users/jahir/dev/jahir/website/node_modules/contentlayer/package.json imported from /Users/jahir/dev/jahir/website/.contentlayer/.cache/v0.1.2/compiled-contentlayer-config.mjs
        at new NodeError (node:internal/errors:371:5)
        at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
        at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
        at packageResolve (node:internal/modules/esm/resolve:873:14)
        at moduleResolve (node:internal/modules/esm/resolve:929:18)
        at defaultResolve (node:internal/modules/esm/resolve:1044:11)
        at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
        at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
        at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
        at link (node:internal/modules/esm/module_job:75:36) {
      code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
    },
    configPath: '/Users/jahir/dev/jahir/website/contentlayer.config.ts'
  },
  [Symbol()]: [ 'configPath', 'error' ]
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
schicklingcommented, Mar 29, 2022

I’ve taken another look at your issue. This will be smoother with the next Contentlayer version but you can already work around it as I’ve described here for you in this video 🙂

https://cln.sh/Uypset

As mentioned in the video and above, this is actually not a Contentlayer issue itself, so I’ll close this issue for now. Please let me know in case you’re running into more problems related to this 😃

0reactions
jahirfiquitivacommented, Mar 29, 2022

@schickling You’re right… I needed to publish an update to my website so I removed it as it was a blocker. I just created the same branch with the same changes and the same issue, if you can take a look I’d really appreciate it 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - Contentlayer
This tutorial will get you comfortable with the basics of Contentlayer by walking through how to to build a simple blog site using...
Read more >
chakra-ui-docs/contentlayer.config.ts at main - GitHub
config.ts. Go to file · Go to file T
Read more >
contentlayer - npm
Start using contentlayer in your project by running `npm i contentlayer`. ... Create contentlayer.config.ts file. import ...
Read more >
Building Better Next.js Static Sites with MDX and Contentlayer
computedFields : derived meta data fields. contentlayer.config.ts. import { defineDocumentType, makeSource } from ' ...
Read more >
How to create a Blog with Contentlayer and NextJs
Import and add contentlayer in next.config.mjs (change the ... Create a file called contentlayer.config.ts in root directory of the project ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found