eslint-config icon indicating copy to clipboard operation
eslint-config copied to clipboard

Conflict with `@nuxt/content` v2

Open davidmyersdev opened this issue 2 years ago • 3 comments

This package and @nuxt/content v2 both depend on different versions of mdast-util-from-markdown. When both of these packages are added to a Nuxt 3 project (via Yarn), the following error occurs (on nuxi dev).

 ERROR  [worker reload] [worker init] Named export 'parseEntities' not found. The requested module 'file:///.../website/node_modules/parse-entities/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///.../website/node_modules/parse-entities/index.js';
const { parseEntities } = pkg;


  import { parseEntities } from 'node_modules/parse-entities/index.js';
  ^^^^^^^^^^^^^
  SyntaxError: Named export 'parseEntities' not found. The requested module 'node_modules/parse-entities/index.js' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:

  import pkg from 'node_modules/parse-entities/index.js';
  const { parseEntities } = pkg;

  at ModuleJob._instantiate (node:internal/modules/esm/module_job:127:21)
  at async ModuleJob.run (node:internal/modules/esm/module_job:193:5)
  at async Promise.all (index 0)
  at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
  at async loadESM (node:internal/process/esm_loader:88:5)
  at async handleMainPromise (node:internal/modules/run_main:61:12)

This is happening because @nuxt/content relies on the newer ESM-only version of mdast-util-from-markdown, while this package (through eslint-plugin-markdown) relies on the older CJS-only version of mdast-util-from-markdown. When both of these packages are added to a project, only one of these dependency versions is being resolved.

davidmyersdev avatar Jun 02 '22 05:06 davidmyersdev

I'm having this problem as well, using the config in my monorepo

Gusb3ll avatar Jun 07 '22 06:06 Gusb3ll

Same issue, thanks @voraciousdev for this detailed explanation!

vvnsrzn avatar Jul 01 '22 07:07 vvnsrzn

I don't really know if there is anything I can do regarding this. I would suggest you open an issue to eslint-plugin-markdown to use the latest version, or to mdast-util-from-markdown to ship CJS + ESM dual formats

antfu avatar Jul 01 '22 08:07 antfu