Comments (2)
@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.
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)
- Custom tagged literals cause build failure HOT 1
- Fails on Java 9? HOT 2
- :asset-path isn't documented HOT 1
- Circular dependencies : Warn user when a namespace requires itself HOT 2
- Adding 'monger' dependency breaks cljsbuild. HOT 2
- Possibility to add cli options to closure compiler. HOT 2
- reload-clojure causes compilation failure in portable projects HOT 4
- Could not write JavaScript nil HOT 1
- Exception (...)/objectutil.js is not a relative path HOT 7
- Consider exposing :watch-fn compiler option? HOT 1
- :prep-tasks dont work when running `lein cljsbuild ...`
- warning-handlers: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn HOT 2
- Duplicate input error HOT 1
- Recompiling compiled app with different optimization type
- Simple example project does not compile HOT 1
- `lein trampoline cljsbuild repl-rhino` fails with jdk 11 HOT 1
- cljsbuild-example-simple didnt run with lein 2.9.5 and Java version > 11 & 15 HOT 1
- cljsbuild cannot find reagent HOT 1
- Fails with ClojureScript newer than 1.10.764 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lein-cljsbuild.