Fork me on GitHub
#clojurescript
<
2017-09-24
>
au-phiware03:09:37

Hello, has anyone used twbs via :npm-deps? I thought I'd give [email protected] a try but I've run into a couple of issues...

au-phiware03:09:49

So, I have this cljsbuild compiler option

:npm-deps {:jquery "3.2.1"
                         :popper.js "1.12.5"
                         :bootstrap "4.0.0-beta"
                         :bootstrap-table "1.11.1"}
but I've that the main prop in bootstrap's package.json doesn't have the file extension and cljsbuild fails to find the package...

au-phiware03:09:56

If I manually tweak node_modules/bootstrap/package.json so that it reads "main": "dist/js/bootstrap.js" cljsbuild appears to be satisfied... Is there anyway to override the main prop of an npm package with a cljsbuild option?

anmonteiro03:09:44

@au-phiware that’s fixed in ClojureScript master

anmonteiro03:09:00

so perhaps easier to use your own built version?

au-phiware03:09:49

oh, ok, cool, no override necessary then (when it's released)?

au-phiware03:09:44

I have another issue...

13:34:01.777 Error: Undefined nameToPath for bootstrap 1 base.js:1357:21
	visitNode 
	visitNode 
	visitNode 
	goog.writeScripts_ 
	goog.require 
	<anonymous> 

au-phiware03:09:06

can you help?

anmonteiro03:09:15

happy to look at a repro from master

anmonteiro03:09:24

otherwise your issue might be solved and we’d both be wasting time

anmonteiro03:09:02

^ here are instructions to build CLJS from master

au-phiware03:09:36

righto, so... sorry, is it possible to get lein-cljsbuild to use master?

anmonteiro03:09:59

build master, note down the version number that has been built and use that in your project.clj

au-phiware03:09:56

ok, great I'll follow the link and give it a try, thanks

au-phiware03:09:00

ok, managed to build from master and it fixes my first issue but I'm still running into Undefined nameToPath for bootstrap... looks like a google closure thing... not sure how to proceed...

anmonteiro03:09:17

@au-phiware make a minimal repro I can look at please

anmonteiro03:09:58

preferably a single source file + a single build script

anmonteiro03:09:02

should be enough to repro your issue

au-phiware03:09:16

but I shall work on the minimal case for you

au-phiware03:09:59

actually, I skipped a step whilst building cljsbuild... I will try again 🙂

au-phiware04:09:28

sorry @anmonteiro, I haven't used cljs.build.api directly before, I feel like I'm missing some very basic here: https://github.com/au-phiware/cljsbuild-bootstrap4

au-phiware04:09:36

ok, I feel that this exhibits the problem, but I need to create a html page to be sure...

au-phiware04:09:30

I can't reproduce the error, but I can't get it to work either! I'm probably missing simple again but I don't have time atm, will have to get back to it later...

au-phiware04:09:59

the last line of main.js doesn't look right

goog.addDependency("../cljsbuild_bootstrap4/core.js", ['cljsbuild_bootstrap4.core'], ['cljs.core', 'bootstrap', 'module$home$corin$Projects$GitHub$cljsbuild_bootstrap4$node_modules$jquery$dist$jquery']);
shouldn't bootstrap be from node_modules? does it collide with something else?

au-phiware05:09:34

@anmonteiro, I realised what I was doing wrong (forgot to add the :main option) and this now reproduces the error... I'll file a JIRA bug

andrea14:09:46

Does anyone have some recommendation on service workers? Is there any suggested library?

krauser17:09:49

sorry if this is a silly question, I've been looking around but haven't been able to find an answer: is it possible to start using clojurescript in an existing node project? e.g. some way to add clojurescript as a dependency in the package.json of an existing npm/yarn project? I have a relatively large project that I'd like to start introducing clojurescript into, but don't want to throw away the js that already exists.

yury.solovyov17:09:17

hmm, not sure if it is the best option, but maybe via Lumo ? https://github.com/anmonteiro/lumo

krauser17:09:03

thanks, I'll take a look 🙂

krauser17:09:45

I think lumo is exactly what I want

dominicm19:09:15

@krauser I don't think lumo is what you're after. Shadow-cljs is more likely. Lumo is a special compilation of node that runs cljs instead (but you can require js from it.) but if you want to augment a js project with some js "modules", you're after shadow-cljs

krauser19:09:29

I think you may be right. I've hacked around for the last little bit with lumo, and am able to compile cljs code in a node project, but haven't been able to integrate the js and cljs code, yet

krauser19:09:33

I'll look at shadow-cljs

krauser19:09:05

yup shadow-cljs is exactly what I needed

krauser19:09:09

should've looked at that first

yury.solovyov21:09:53

anyone using core.async in cljs, do we still have to (:require-macros [cljs.core.async.macros :as async]) separately?

yury.solovyov21:09:36

I guess refer-macros won't work either?

anmonteiro21:09:22

no, because it’s a different namespace