JS output should not use `this` in strict mode
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 281
- Forks
- 30
- Avg merge
- 5h 30m
- Merged PRs (30d)
- 4
Description
When I try to use this repo in the browser, I see an error related to the output that it uses `this` instead of `globalThis` or `window`.
See the last line of https://unpkg.com/mldoc@1.1.8/index.js
The whole js is an IIFE like this:
```js
(function(joo_global_object)
(function(){return this}()));
```
This may be related to https://github.com/ocsigen/js_of_ocaml/issues/699
There is a potential fix to add `wrap-with-fun` flag or command, but I do not understand OCaml or its tools. In the [test](https://github.com/pengx17/mldoc-test/blob/main/patches/mldoc%2B1.1.8.patch) I do a manual patch to `mldoc` instead. Not sure if the issue will fixed by logseq team or not?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the last line of the generated index.js from mldoc@1.1.8 and compare it with the manual change in the linked mldoc+1.1.8.patch. Trace the OCaml or js_of_ocaml build entry point that produces this wrapper, then verify the browser output no longer relies on this in strict mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, ocaml
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100