Fork me on GitHub
#re-frame
<
2022-08-29
>
bob00:08:08

Hi, I have a deps.edn/figwheel-main re-frame project that I'm trying to add re-frame-10x to. The deps.edn (day8.re-frame/re-frame-10x {:mvn/version "1.5.0"}) and dev.cjls.edn (:preloads [day8.re-frame-10x.preload]) seem correct and the project builds without errors. When the web app is started though, I get this error: Uncaught Error: Bad dependency path or symbol: highlight.js.lib.core Any ideas on a solution?

mikethompson01:08:46

@robert.nadler I'd use re-frame-template to create a new project, and include re-frame-10x. That will give you a working project to compare against.

mikethompson01:08:23

Also, if your project has an explicit dependency on highlight.js, then ensure you are using a version compatible with that used internally by re-frame-10x ...which is just say a recent version

bob01:08:37

The re-frame-template builds a shadow-cljs project. I've already tried to use shadow-cljs with :deps true to pick up the deps.edn dependencies. That path has led to other build dependency failures (specifically "cljsjs.husl"). The code base I'm working with is rather large and I'm trying to avoid going down too many rabbit holes...

mikethompson01:08:21

From the sounds of your problem, I'd just be looking at the deps

mikethompson01:08:04

Does your project have an explicit dependency on highlight.js ?

bob01:08:05

No. Only re-frame-10x is bringing in that dependency.

steveb8n02:08:21

I think I've solved this in past by adding highlight to package.json. could be shadow :deps true causes this

bob03:08:54

I have the correct version of highlight.js in package.json. I don't think deps.edn builds include npm libs though.

superstructor05:08:24

@robert.nadler the error is coming from here - https://github.com/superstructor/re-highlight/blob/master/src/re_highlight/core.cljs And I suspect is related to figwheel not supporting the same npm require forms as shadow-cljs.

Luke Zeitlin10:08:12

Having the same problem. Using figwheel-main. tried adding highlight manually with yarn and it doesn't help

Luke Zeitlin10:08:22

No such namespace: highlight.js/lib/core, could not locate highlight/js_SLASH_lib_SLASH_core.cljs, highlight/js_SLASH_lib_SLASH_core.cljc, or JavaScript source providing "highlight.js/lib/core" (Please check that namespaces with dashes use underscores in the ClojureScript file name) in file target/public/cljs-out/dev/re_highlight/core.cljs

   1  (ns re-highlight.core
   2    (:require
   3      [goog.object                          :as gobj]
   4      [reagent.core                         :as r]
   5      [reagent.dom                          :as rdom]
   6      ["highlight.js/lib/core"              :as hljs]
            ^---
   7      ["highlight.js/lib/languages/clojure" :as clojure]))
   8
   9  (def hljs-highlight-element (gobj/get hljs "highlightElement"))
  10  (def ^:private hljs-init-highlighting (gobj/get hljs "initHighlighting"))
  11  (def hljs-register-language (gobj/get hljs "registerLanguage"))

superstructor10:08:59

I don't use figwheel so if someone who does use it has a known fix to suggest or submit a PR for I'm happy to apply it.

bob00:08:45

@U0G75S29H Thanks for the help. This is a side project, so not sure when I'll be able to get to it. Will let you know though. Damned day job! 🙂