-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReferenceError: require is not defined #44
Comments
This doesn't work either: org.scalajs.dom.window.asInstanceOf[js.Dynamic].MessageChannel =
js.Dynamic.global.require("worker_threads").MessageChannel Isn't |
jsdom is not Node.js. jsdom goes out of its way to expose a browser-like environment within Node.js, so it hides things like |
Wait, jsdom hides |
I can't find anything in the jsdom code that attempts to remove or replace |
The |
Thanks, I created an elaborate regex over |
You can't disable the hiding mechanism, but you can explicitly reintroduce things inside the This fork does precisely that. |
Ah ok cool. Can we merge it into this main repo? Maybe behind a flag if you're cautious? |
IMO it does not fit the philosophy of this repo. With this repo, we are trying to expose a browser-like environment more than a Node.js environment. If we start exposing The beauty of open source is that not everyone has to agree with the philosophy. It's very good that one can just create a fork with another philosophy and publish it, and people can use it. |
This repo doesn't say anything about the browser though, and why should it, especially now that it's been decoupled from Scala.JS itself? After all it's Jokes aside though, what other aspects of a browser-like environment is this repo applying if any? Or maybe phrased another way, providing access to Node JS is the purpose of this library right? Why would the philosophy go beyond that and be opinionated if it doesn't have to. It think it's very reasonable to anyone who comes knocking on this library's door (and they will over forks and other OSS that you suggested because of that big shiny "org.scala-js" groupId), it's reasonable that they are going to assume that they have access to an unconstrained Node JS env. |
Perhaps the name of the env is inaccurate, but it has always been about providing a reliable headless-browser-like environment. The fact that it uses jsdom on Node.js to do so is the strategy more than a public contract.
I'm happy to add a note in the readme that people who want |
I've got this in my SBT:
and this
src/test/resources/polyfill.js
:When I run my tests I get this error:
The
polyfill.js
is being executed by Node so usingrequire()
should work, no?The text was updated successfully, but these errors were encountered: