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.

DeprecationWarning: No "main" or "exports" field defined

See original GitHub issue

next-mdx-remote 4.0.0-rc.1 node v16.10.0

[DEP0151] DeprecationWarning: No "main" or "exports" field defined in the package.json for ***\node_modules\next-mdx-remote\ resolving the main entry point "index.js", imported from ***.js.
Default "index" lookups for the main are deprecated for ES modules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
jescalancommented, Jan 11, 2022

You can ignore the deprecation warning for now. Put up a PR that should get rid of it https://github.com/hashicorp/next-mdx-remote/pull/223

0reactions
philspcommented, Jan 11, 2022

Hmm, building the following (compacted) example from the readme on Node 16.13.2 LTS (Windows (x64)) also shows the deprecation warning. Is there any other way to import this package that I’m missing?

pages/index.js

import { serialize } from 'next-mdx-remote/serialize'
import { MDXRemote } from 'next-mdx-remote'

const Test = () => <em>Test</em>;

export default function TestPage({ source }) {
  return <MDXRemote {...source} components={{ Test }} />
}

export async function getStaticProps() {
  return { props: { source: await serialize('Some **mdx** text, with a component <Test />') } }
}

package.json

{
  "scripts": {
    "build": "next build"
  },
  "dependencies": {
    "next-mdx-remote": "4.0.0-rc.1",
    "next": "12.0.7",
    "react": "17.0.2",
    "react-dom": "17.0.2"
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing main or exports field · Issue #52 - GitHub
Node 16.9.1 DeprecationWarning: No "main" or "exports" field defined in the package.json for ".../imagemin-svgo" resolving the main entry ...
Read more >
Ask Question - Stack Overflow
DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at "...\node_modules\postcss\ ...
Read more >
[DEP0151] DeprecationWarning under Node.js 16 #365
[DEP0151] DeprecationWarning: No "main" or "exports" field defined in the package.json for /Users/chenxi/Desktop/imufu/xingmeiji-solver/node_modules/ky/ ...
Read more >
Modules: Packages | Node.js v19.3.0 Documentation
The "main" field is supported in all versions of Node.js, but its capabilities are limited: it only defines the main entry point of...
Read more >
Main property in package.json defines package entry point
exports object is returned as the return value of a require() -call. First, Node looks for a package.json file and checks if it...
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