html-escaper: require broken in early Node.js 13.x runtime

See below, 2.0.1 is not usable on these Node versions, since its a dependency for CI code coverage tools such as istanbul we’re seeing failures in our CI that tests specific node release lines that changed V8 versions because of this.

node -v
v13.0.0

node -e "require('html-escaper')"                               
internal/modules/cjs/loader.js:417
      throw e;
      ^

Error: Package exports for '/Users/panva/repo/ultimate-jose/node_modules/html-escaper' do not define a '.' subpath
    at resolveExports (internal/modules/cjs/loader.js:414:17)
    at Function.Module._findPath (internal/modules/cjs/loader.js:487:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:782:27)
    at Function.Module._load (internal/modules/cjs/loader.js:688:27)
    at Module.require (internal/modules/cjs/loader.js:850:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at [eval]:1:1
    at Script.runInThisContext (vm.js:116:20)
    at Object.runInThisContext (vm.js:306:38)
    at Object.<anonymous> ([eval]-wrapper:9:26) {
  code: 'MODULE_NOT_FOUND'
}

dtto on 13.0.1 and 13.1.0, later versions are okay.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

@panva @coreyfarrell V3 is out, apologies for the bumpy ride in V2 👋

@WebReflection I think the issue is that node.js 13.0.0 - 13.1.0 had a bug in the exports processing. My understanding is that this can be worked around by using array notation to provide the “default” export:

"exports": [
  {"import": "./esm/index.js"},
  "./cjs/index.js"
]

I will nvm install 13.0.0 and manually patch the installed node_modules/html-escaper/package.json to confirm this.