JavaScript Module & CORS error
Because of the way your browser implements JavaScript
modules this demo page needs to be loaded from a web server
over HTTP to work. You could upload the files somewhere, or
perhaps use a local web server like python3 -m
http.server or python -m SimpleHTTPServer or
ruby -run -e httpd . or http-server
from npm, or
osws -m -d .
— or any of the others from
this big
list of HTTP static server one-liners.
You could also load this page in Firefox, which permits local files to see their neighbours, or start Chrome with the --allow-file-access-from-files command-line option.
In practical use, if local-file access is important, you can
remove the last two lines from jq.js (the ones
starting export
) and then use
<script src="jq.js"></script>
<script>
let func = jq.compile(".x[].y")
for (let x of func(obj)) {
...
</script>
as usual.