Code Monkey home page Code Monkey logo

Comments (2)

leblowl avatar leblowl commented on June 26, 2024

@art-solopov I ran into something similar, except I get a different error, like invalid nameToPath or something. On first compilation, the dependency is required in cljs_deps.js. Second compilation, it's missing. I haven't tracked down where in lein-cljsbuild the error is. The code looks pretty simple, but there is also quite a bit of logic. I tested using run-compiler from this library directly (in support subproject), everything works well. I tested using the ClojureScript compiler directly, everything works well. So not sure what's going on just yet.

This isn't a fix for this exact problem, but as an alternative to Leiningen/cljs-build, you can use deps.edn and the ClojureScript compiler directly. The ClojureScript compiler appears to offer the same auto functionality as this plugin. Here is a basic example I drafted:

(require '[cljs.build.api :as cljs])
(require '[cljs.closure :as closure])
(cljs/watch (closure/compilable-input-paths ["src" "src-cljs" "env/dev/cljs"])
         {:asset-path "/js"
          :output-to    "target/cljsbuild/public/js/app.js"
          :output-dir   "target/cljsbuild/public/js"
          :main         'my.app
         
          :install-deps true
          :npm-deps {:moment "2.22"}

          :source-map   true
          :pretty-print true
          :verbose      true})

Update 2019-07-14
@art-solopov Thanks for the simple sample project, I have been using it for testing this issue.

I believe I've narrowed down the issue to the use of cljs.env/*compiler* here https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L137... If I comment the binding, it works. I found cljs.env/*compiler* here https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/env.cljc

I am not very familiar with Clojurescript or lein-cljsbuild code but my guess is that the compiler depends on cljs.env/*compiler* internally and cljsbuild re-binds it to an initial value for each run of the compiler, thus messing up the compiler. The compiler env is defined here for each build: https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L109 and then for each loop of the compiler, it looks like the same immutable compiler env is used: https://github.com/emezeske/lein-cljsbuild/blob/master/plugin/src/leiningen/cljsbuild.clj#L122 ... Maybe the compiler is expecting different state in cljs.env/*compiler*

Related initial commit:
4fb2670

Related update:
8bd20c9

These are from 5-6 years ago. It says Clojurescript was version 0.0-2197 in one commit message...
The initial commit says it was added to support incremental compilation. I thought the Clojurescript incremental compilation just works without the environment binding now.

from lein-cljsbuild.

abradley2 avatar abradley2 commented on June 26, 2024

This has bit my as well. I can't quite figure out how to move of leiningen and achieve this same configuration with deps.edn

from lein-cljsbuild.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.