postlight / parser

📜 Extract meaningful content from the chaos of a web page
https://reader.postlight.com
Apache License 2.0
5.41k stars 442 forks source link

How to run it in an environment without Node.js? #587

Closed pxmage closed 4 years ago

pxmage commented 4 years ago

Expected Behavior

Be able to run in a pure javascript(without node.js) environment.

Current Behavior

not working

Steps to Reproduce

import 'mercury.web.js' into a non-node.js project.

Detailed Description

I was thinking that 'mercury.web.js' is for an environment without Node.js like the browser.

Then I import the 'mercury.web.js' into my React Native project, and it reports an error:

Unable to resolve module `path` from `node_modules/jsdom/lib/api.js`: path could not be found within the project.

So I checked the 'mercury.web.js' and I found some code inside this file like:

require("jsdom")

Obviously, this will not work in the browser nor an environment without node.js.

How do I supposed to use it in such environment?

pxmage commented 4 years ago

After a lot of investigations were done, I found it is impossible to run 'jsdom' in React Native environment, I'm closing this.