I'm using krell (so unreleased cljs version). The code generated when i use default seems broken... It seems to get a "$" postfix. Note how module/default
becomes .default$
but (.-default)
becomes .default
For for example...
(ns connect-app.utils.rnc-datetimepicker
(:require ["@react-native-community/datetimepicker" :as module :refer [default abc]]
[goog.object :as gobj]))
(def RNDateTimePicker1 module/default)
(def RNDateTimePicker2 (.-default module))
(def RNDateTimePicker3 (gobj/get module "default"))
(def RNDateTimePicker4 default)
Produces this...
// Compiled by ClojureScript 0.0.1780021040 {:target :nodejs}
goog.provide('connect_app.utils.rnc_datetimepicker');
goog.require('cljs.core');
goog.require('goog.object');
connect_app.utils.rnc_datetimepicker.node$module$_CIRCA_react_native_community$datetimepicker = require('@react-native-community/datetimepicker');
connect_app.utils.rnc_datetimepicker.RNDateTimePicker1 = connect_app.utils.rnc_datetimepicker.node$module$_CIRCA_react_native_community$datetimepicker.default$;
connect_app.utils.rnc_datetimepicker.RNDateTimePicker2 = connect_app.utils.rnc_datetimepicker.node$module$_CIRCA_react_native_community$datetimepicker.default;
connect_app.utils.rnc_datetimepicker.RNDateTimePicker3 = goog.object.get(connect_app.utils.rnc_datetimepicker.node$module$_CIRCA_react_native_community$datetimepicker,"default");
connect_app.utils.rnc_datetimepicker.RNDateTimePicker4 = connect_app.utils.rnc_datetimepicker.node$module$_CIRCA_react_native_community$datetimepicker.default$;
The variants which produce .default$
don't work for accessing default exports from npm libs.
@olivergeorge default
used to be a reserved name in JS so CLJS mangles it unless configured not to.
but might be that the code that covers this doesn't handle the ns alias properly
certainly looks like that
@olivergeorge you need to configure :language-out
I'm pretty sure this was sorted a couple of years ago - I'm assuming it should work for :es6
if not - a bug
Thanks. I’ll give that a try.
Confirmed, adding :language-out :es6 did the trick all variants working now.
@dnolen seems like that might be a sensible default for krell.
sure