microlinkhq / metascraper

Get unified metadata from websites using Open Graph, Microdata, RDFa, Twitter Cards, JSON-LD, HTML, and more.

Home Page:https://metascraper.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use in Defer because of re2

adaboese opened this issue · comments

Getting error:

17:38:05.723 (plugin commonjs--resolver) RollupError: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)             /workspace/node_modules/re2/build/Release/re2.node (1:0)             1: �ELF�����>����@����@8                ^

This is happening because re2 is a native dependency and https://defer.run tries to bundle it.

That makes it impossible to use the two together.

Is there a way to not depend on re2?

Hello,

Try to set process.env.METASCRAPER_RE2 to 'true' in your bundle system:

? process.env.METASCRAPER_RE2 === 'true'

Alternatively, you can write a patch-package:
https://github.com/ds300/patch-package

If you find a better solution I will be happy to add it to the README to help others 🙂