browser friendly
Kikobeats opened this issue · 6 comments
Hello,
I'm opening this issue because, although I adopted url-regex-safe
instead of url-regex
, recently discovered url-regex-safe
depends on re2
and it isn't a suitable browser dependency:
There is a proposition to make re2
browser friendly
but until that happens, this is making me not possible to adopt url-regex-safe
not sure if you have an opinion about that, just I wanted to warn you 🙂
This does work in the browser. I made it so it doesn't require re2
in the browser, see package.json
and the code.
If you can share a reproducible repo I could try to find time to look at this, guessing its a bundler issue or yarn/npm. What version of Node are you on?
reproducible example: https://runkit.com/kikobeats/5f85c1f39b9a71001a1025c7
Same here, I can't use in a simple Vue app
Cannot find module './build/Release/re2' from 're2.js'
Is it possible to be related with re2 install script not being called?
install-from-cache --artifact build/Release/re2.node --host-var RE2_DOWNLOAD_MIRROR || npm run rebuild
.
Maybe url-regex-safe can't find the re2 module because the .node file wasn't installed yet.
const RE2 = require('./build/Release/re2');
The solution may be to use lazy import with re2 or url-regex-safe.