You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It shouldn't be too hard to first hotfix and then implement Alternative 2.
It might also be relevant that the standalone compilation mode now is whole program. That is, we do not generate separate files that need to be linked when compiling to JS. This is only enabled for the website.
Currently, the
commonjs
export produces the following export at the end:Unfortunately, browsers use a completely different module system so this produces a crash at runtime (as
module
doesn't exist).Alternative 1
Let's hot-fix that by generating the following export (or a similar one) which works both in a browser and in Node.JS:
[where
$MODULE_NAME
is the name of our module]🪄 Here's the `sed` call needed
Here's the code that would need to be changed:
effekt/effekt/shared/src/main/scala/effekt/generator/js/Tree.scala
Lines 46 to 48 in 6f8973a
Alternative 2
Let's use ES modules instead! They have been stable for about 15 years by now and work both in a browser and in Node*.
This way, we could also get rid of the following hack:
effekt/effekt/js/src/test/scala/effekt/WebTests.scala
Lines 29 to 34 in 6f8973a
*The only issue is that for Node.JS, all of our files would have to have the
.mjs
extension...The text was updated successfully, but these errors were encountered: