This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-11
Channels
- # announcements (1)
- # beginners (67)
- # calva (4)
- # cider (6)
- # clj-kondo (26)
- # clojure (61)
- # clojure-belgium (2)
- # clojure-sweden (1)
- # clojurescript (12)
- # community-development (27)
- # cursive (2)
- # datascript (4)
- # datomic (20)
- # emacs (4)
- # funcool (1)
- # graphql (11)
- # honeysql (3)
- # malli (15)
- # membrane (6)
- # nbb (4)
- # nextjournal (7)
- # pathom (8)
- # polylith (7)
- # rdf (1)
- # re-frame (1)
- # releases (2)
- # shadow-cljs (42)
- # specter (3)
- # tools-deps (25)
- # xtdb (17)
Is there a way with target esm to emit .mjs
files rather than .js
files? I have a project which requires the entry point to be a cjs .js
file
we almost got the electron thing working with target esm, but the entrypoint file must be a cjs file with the .js extension
I guess I'm confused by your statement. I mean it might be ok to write that cjs file yourself in JS and just call out to the ESM code?
yes, believe me, I've written some boilerplate. but the entrypoint must be a file which cannot end with .cjs
and because of target esm we must state "type": "module", which means every .js file is an esm file
does the trick work to put the ESM output into its own folder with its own package.json type module
We're basically running into this issue: https://github.com/microsoft/vscode-vsce/issues/824
did you try the separate folder trick? I'm not sure how type:module is handled for sub dirs, or if its only recognized at the root
If I define a global like:
globalThis.joyride_vscode = require("vscode");
(for reasons...) and refer to it from CLJS as:
(def vscode js/joyride_vscode)
and then do:
(vscode.window.showInputBox ...)
how can I prevent advanced renaming these usagesI tried an externs file like:
global:joyride_vscode
window
showInputBox
createOutputChannel
showInformationMessage
but this gets a bit tediousthis vscode.window.showInputBox
may just loose the necessary type info, did you try with proper interop?
(.. vscode -window (showInputBox ...))
might work, although I remember something about ..
not preserving typehints
maybe it also helps to define a .js file and then import vscode from that .js file which retrieves the global?
why are doing this in the first place? (:require ["vscode" :as x])
x/window.showInputBox
should properly infer
because the cjs + esm hack we're now in, gave us "cannot find module vscode" errors, I think because in vscode, that module is implicit
@U05224H0W It seems vscode itself has problems with it:
So this as workaround helps, I think: src/joyride/vscode.js
module.exports = globalThis.joyride_vscode;
and then:
["/joyride/vscode.js" :as vscode]
Do you happen to know where this error might be coming from in watch mode?
Activating extension 'betterthantomorrow.joyride' failed: WebSocket is not defined.
My workaround for this is:
globalThis.WebSocket = require("ws");
in the main wrapper, but I wonder if there's a better solutionI made it conditional like this now:
ws_file = require.resolve("ws");
if (ws_file != null) {
globalThis.WebSocket = require(ws_file);
}