Fork me on GitHub
#shadow-cljs
<
2022-03-06
>
thheller07:03:58

@lilactown should be fine in 1.17.7, it did in fact use the incorrect package.json for "browser" overrides

lilactown16:03:29

thanks @U05224H0W. appreciate it

jaime14:03:06

Hi, I've seen some cljs ns with {:skip-goog-provide true} https://github.com/thheller/shadow-cljsjs/blob/master/src/main/firebase/app.cljs. Is it specific to shadow-cljs only?

(ns 
  {:skip-goog-provide true}
  (:require ["@firebase/app" :refer (firebase)]))

jaime14:03:43

Thanks. Looks like the goog.provide overwrites the firebase object here causing undefined initializeApp

// Input 293
var firebase = {app:{}}; <------------------------------------------------------------- goog.provide?????
firebase.app.node$module$_CIRCA_firebase$app = __webpack_require__(5752);
console.log("\x3d\x3d\x3d JAIME \x3d\x3d\x3d firebase \x3d\x3d\x3d ", firebase.app.node$module$_CIRCA_firebase$app);
console.log("\x3d\x3d\x3d JAIME \x3d\x3d\x3d (.-initializeApp firebase) \x3d\x3d\x3d ", firebase.app.node$module$_CIRCA_firebase$app.initializeApp);
console.log("\x3d\x3d\x3d JAIME \x3d\x3d\x3d firebase.initializeApp \x3d\x3d\x3d ", firebase.app.node$module$_CIRCA_firebase$app.initializeApp);
goog.exportSymbol("firebase", firebase.app.node$module$_CIRCA_firebase$app);
// Input 294
com.degel = {};
com.degel.re_frame_firebase = {};
com.degel.re_frame_firebase.core = {};
if ("undefined" === typeof com || "undefined" === typeof com.degel || "undefined" === typeof com.degel.re_frame_firebase || "undefined" === typeof com.degel.re_frame_firebase.core || "undefined" === typeof com.degel.re_frame_firebase.core.firebase_state) {
  com.degel.re_frame_firebase.core.firebase_state = cljs.core.atom.call(null, cljs.core.PersistentArrayMap.EMPTY);
}
com.degel.re_frame_firebase.core.set_firebase_state = function($var_args$$) {
  for (var $args__4824__auto__$jscomp$316_argseq__4825__auto__$$ = [], $len__4818__auto___51875$$ = arguments.length, $i__4819__auto___51876$$ = 0;;) {
    if ($i__4819__auto___51876$$ < $len__4818__auto___51875$$) {
      $args__4824__auto__$jscomp$316_argseq__4825__auto__$$.push(arguments[$i__4819__auto___51876$$]), $i__4819__auto___51876$$ += 1;
    } else {
      break;
    }
  }
  $args__4824__auto__$jscomp$316_argseq__4825__auto__$$ = 0 < $args__4824__auto__$jscomp$316_argseq__4825__auto__$$.length ? new cljs.core.IndexedSeq($args__4824__auto__$jscomp$316_argseq__4825__auto__$$.slice(0), 0, null) : null;
  return com.degel.re_frame_firebase.core.set_firebase_state.cljs$core$IFn$_invoke$arity$variadic($args__4824__auto__$jscomp$316_argseq__4825__auto__$$);
};
com.degel.re_frame_firebase.core.set_firebase_state.cljs$core$IFn$_invoke$arity$variadic = function($JSCompiler_temp_const$jscomp$9$$) {
  $JSCompiler_temp_const$jscomp$9$$ = cljs.core.__destructure_map.call(null, $JSCompiler_temp_const$jscomp$9$$);
  var $JSCompiler_temp_const$$ = cljs.core.get.call(null, $JSCompiler_temp_const$jscomp$9$$, new cljs.core.Keyword(null, "get-user-sub", "get-user-sub", 1337447940)), $JSCompiler_temp_const$jscomp$0$$ = cljs.core.get.call(null, $JSCompiler_temp_const$jscomp$9$$, new cljs.core.Keyword(null, "set-user-event", "set-user-event", -2139443858)), $JSCompiler_inline_result$$ = cljs.core.get.call(null, $JSCompiler_temp_const$jscomp$9$$, new cljs.core.Keyword(null, "default-error-handler", "default-error-handler", 
  2070828115));
  $JSCompiler_temp_const$jscomp$9$$ = cljs.core.swap_BANG_;
  var $JSCompiler_temp_const$jscomp$1$$ = $JSCompiler_temp_const$jscomp$9$$.call, $JSCompiler_temp_const$jscomp$2$$ = com.degel.re_frame_firebase.core.firebase_state, $JSCompiler_temp_const$jscomp$3$$ = cljs.core.assoc, $JSCompiler_temp_const$jscomp$4$$ = new cljs.core.Keyword(null, "set-user-fn", "set-user-fn", -1107518278);
  $JSCompiler_temp_const$jscomp$0$$ = iron.re_utils.event__GT_fn.call(null, $JSCompiler_temp_const$jscomp$0$$);
  var $JSCompiler_temp_const$jscomp$5$$ = new cljs.core.Keyword(null, "get-user-fn", "get-user-fn", -1714413522);
  $JSCompiler_temp_const$$ = iron.re_utils.sub__GT_fn.call(null, $JSCompiler_temp_const$$);
  var $JSCompiler_temp_const$jscomp$6$$ = new cljs.core.Keyword(null, "default-error-handler", "default-error-handler", 2070828115), $JSCompiler_temp_const$jscomp$7$$ = iron.re_utils.event__GT_fn, $JSCompiler_temp_const$jscomp$8$$ = $JSCompiler_temp_const$jscomp$7$$.call;
  $JSCompiler_inline_result$$ = cljs.core.truth_($JSCompiler_inline_result$$) ? $JSCompiler_inline_result$$ : alert;
  return $JSCompiler_temp_const$jscomp$1$$.call($JSCompiler_temp_const$jscomp$9$$, null, $JSCompiler_temp_const$jscomp$2$$, $JSCompiler_temp_const$jscomp$3$$, $JSCompiler_temp_const$jscomp$4$$, $JSCompiler_temp_const$jscomp$0$$, $JSCompiler_temp_const$jscomp$5$$, $JSCompiler_temp_const$$, $JSCompiler_temp_const$jscomp$6$$, $JSCompiler_temp_const$jscomp$8$$.call($JSCompiler_temp_const$jscomp$7$$, null, $JSCompiler_inline_result$$));
};
com.degel.re_frame_firebase.core.set_firebase_state.cljs$lang$maxFixedArity = 0;
com.degel.re_frame_firebase.core.set_firebase_state.cljs$lang$applyTo = function($seq51872$$) {
  return this.cljs$core$IFn$_invoke$arity$variadic(cljs.core.seq.call(null, $seq51872$$));
};
com.degel.re_frame_firebase.core.initialize_app = function($firebase_app_info$$) {
  return firebase.initializeApp(cljs.core.clj__GT_js.call(null, $firebase_app_info$$)); <--------------------------- initializeApp is not a function
};

thheller14:03:23

yes, that is what that meant to fix

jaime14:03:32

Thanks for confirming. I think I'll just have to write script to delete that line for now 😅

thheller15:03:12

hmm? does it not work anymore?

thheller15:03:23

oh I guess you are not using shadow-cljs?

jaime18:03:49

Yes. Right now, just trying to make it work with figwheel-main.

thheller19:03:17

then you probably should not be using shadow-cljsjs. instead just exclude the cljsjs/firebase and provide your own proper :foreign-libs definition. figwheel supports those, so in theory you don't need the shadow-cljsjs hack

jaime19:03:46

Oh, should it look like this?

:foreign-libs
 [{:file "node_modules/@firebase/app/dist/index.cjs.js"
   :provides ["@firebase/app"]
   :module-type :commonjs}]
Think I need to do this for other @firebase/* (database, firestore). Can I assume CLJS compiler can infer the externs?