mrzmmr/unist-util-find-all-between

fix the "Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"

Opened this issue · 1 comments

Can you support also ESM with "type": "module", in package.json.

The main issue is unist-util-find actually, and it needs to use import instead of require() in index.js file

import {is} from 'unist-util-is';
import find from 'unist-util-find';

Can you upgrade the dependencies also?

Lack of the upgrade causes the error "Error [ERR_REQUIRE_ESM]: require() of ES Module not supported" in nextjs application.

from

  "dependencies": {
    "unist-util-find": "^1.0.1",
    "unist-util-is": "^4.0.2"
  },

to

  "dependencies": {
    "unist-util-find": "^1.0.3",
    "unist-util-is": "^5.2.1"
  },

Actually, this remark plugin should be totally inlined with the unist-util-find-all-after and unist-util-find-all-before.

You don't need to use unist-util-find.

I created a new plugin unist-util-find-between-all that is totally inlined with the mentioned packages. You can copy past everything including the test file from my package, then I will remove the package, since the name unist-util-find-all-between I mean yours is more convenient.