Skip to content

.replace is not a function #909

Discussion options

You must be logged in to vote

The error comes from WMR's module resolution:

function resolveLegacyEntry(pkg, path) {
const entry =
_resolveLegacyEntry(pkg, {
browser: true,
fields: ['esmodules', 'modern', 'module', 'jsnext:main', 'browser', 'main']
}) || 'index.js';
return '/' + entry.replace(/^\.?\//, '');
}

It looks like this might be upstream issue in resolve.exports, or perhaps bn.js is using an invalid configuration of the (very loose) "browser" field spec.

bn.js

{
  "browser": {
    "buffer": false
  }
}

entry gets resolve to { buffer: false }, which obviously isn't a module (and th…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jeffersonbenson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants