sindresorhus/matcher

Version 5.0.0 ERR_REQUIRE_ESM error

Closed this issue · 2 comments

Version 5.0.0 appears to use an import statement which breaks node.js builds expecting CommonJS modules:

09:49:43  internal/modules/cjs/loader.js:1015
09:49:43        throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
09:49:43        ^
09:49:43  
09:49:43  Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: node_modules/matcher/index.js

This is a very aggressive change for what is essentially a utility function. By making an application switch to ESM to use this library, it forces all users of that application to also switch to ESM. Please consider bundling a cjs file to ease the transition. It seems to be a matter of adding a "main" property to the package.json file that point to the cjs file.