shadow-cljs
shadow-cljs copied to clipboard
Failed to inspect file when trying to use a dependency from NPM
I had to use a NPM dependency that have the following code on it:
class GitHost {
constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) {
Object.assign(this, GitHost.#gitHosts[type], {
type,
user,
auth,
project,
committish,
default: defaultRepresentation,
opts,
})
}
static #gitHosts = { byShortcut: {}, byDomain: {} }
///...
}```
This, surprisingly, is valid Javascript code, but when I tried to add this dependency to shadow-cljs (either by using `:target :browser` or by using `:js-options {:js-provider :shadow}`) the build fails with the message:
Failed to inspect file /home/mauricio/...
it was required from /home/mauricio/...
Errors encountered while trying to parse file /home/mauricio/... {:line ..., :message "'identifier' expected"}
The line and column match exactly the beginning of `.#gitHosts[type],`
This is not yet supported by the Closure Compiler I guess. You can use :js-provider :external if you must use this package. Otherwise we'll have to wait till the Closure Compiler implements it. Nothing I can do from the shadow-cljs side.
This is the related issue https://github.com/google/closure-compiler/issues/2731. Still nothing though.