uhop / node-re2

node.js bindings for RE2: fast, safe alternative to backtracking regular expression engines.
Other
479 stars 53 forks source link

Bug in var RE2 = require("re2"); #189

Closed adityak2502 closed 10 months ago

adityak2502 commented 10 months ago

I am using react. When I do, var RE2 = require("re2");. I get

Uncaught TypeError: Cannot set properties of undefined (setting 'Symbol(Symbol.match)') at ./node_modules/re2/re2.js (re2.js:6:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./src/pages/OnboardingPage.js (OnboardingPage.js:20:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./src/App.js (check_success.svg:29:1) at options.factory (react refresh:6:1)

OnboardingPage.js:20 var RE2 = require("re2"); ./node_modules/re2/re2.js :

if (typeof Symbol != 'undefined') {
  Symbol.match &&
    (RE2.prototype[Symbol.match] = function (str) {
      return this.match(str);
    });

Symbol.match is on line 6

uhop commented 10 months ago

This project is for Node only. It will not work on a browser. Sorry.

adityak2502 commented 10 months ago

I get same error in node too. I have added it index.js, but still I am having same error

uhop commented 10 months ago

How to repro? It'll help to have a minimal package.json, a test file, and a sequence of commands that demonstrate the problem. Thank you in advance.

uhop commented 10 months ago

Closing in favor of https://github.com/uhop/node-re2/issues/190