mirror of https://github.com/status-im/reagent.git
Merge pull request #365 from reagent-project/cljs-options
Fix and optimize Cljs compiler options
This commit is contained in:
commit
1c5d361070
82
project.clj
82
project.clj
|
@ -4,7 +4,6 @@
|
||||||
:description "A simple ClojureScript interface to React"
|
:description "A simple ClojureScript interface to React"
|
||||||
|
|
||||||
:dependencies [[org.clojure/clojure "1.9.0"]
|
:dependencies [[org.clojure/clojure "1.9.0"]
|
||||||
[org.clojure/clojurescript "1.10.238"]
|
|
||||||
;; If :npm-deps enabled, these are used only for externs.
|
;; If :npm-deps enabled, these are used only for externs.
|
||||||
;; Without direct react dependency, other packages,
|
;; Without direct react dependency, other packages,
|
||||||
;; like react-leaflet might have closer dependency to a other version.
|
;; like react-leaflet might have closer dependency to a other version.
|
||||||
|
@ -24,27 +23,35 @@
|
||||||
:exclude clojure.string
|
:exclude clojure.string
|
||||||
:source-paths ["src"]}
|
:source-paths ["src"]}
|
||||||
|
|
||||||
:profiles {:dev {:dependencies [[figwheel "0.5.15"]
|
:profiles {:dev {:dependencies [[org.clojure/clojurescript "1.10.238"]
|
||||||
|
[figwheel "0.5.15"]
|
||||||
[doo "0.1.10"]
|
[doo "0.1.10"]
|
||||||
[com.google.javascript/closure-compiler-unshaded "v20180319"]
|
[com.google.javascript/closure-compiler-unshaded "v20180319"]
|
||||||
[cljsjs/prop-types "15.6.0-0"]]
|
[cljsjs/prop-types "15.6.0-0"]]
|
||||||
:source-paths ["demo" "examples/todomvc/src" "examples/simple/src" "examples/geometry/src"]
|
:source-paths ["demo" "test" "examples/todomvc/src" "examples/simple/src" "examples/geometry/src"]
|
||||||
:resource-paths ["site" "target/cljsbuild/client" "target/cljsbuild/client-npm"]}}
|
:resource-paths ["site" "target/cljsbuild/client" "target/cljsbuild/client-npm"]}}
|
||||||
|
|
||||||
:clean-targets ^{:protect false} [:target-path :compile-path "out"]
|
:clean-targets ^{:protect false} [:target-path :compile-path "out"]
|
||||||
|
|
||||||
:figwheel {:http-server-root "public" ;; assumes "resources"
|
:figwheel {:http-server-root "public" ;; assumes "resources"
|
||||||
:css-dirs ["site/public/css"]
|
:css-dirs ["site/public/css"]
|
||||||
:repl false}
|
:repl false
|
||||||
|
;; :npm-deps and :stable-names
|
||||||
|
:validate-config false}
|
||||||
|
|
||||||
;; No profiles and merging - just manual configuration for each build type
|
;; No profiles and merging - just manual configuration for each build type.
|
||||||
|
;; For :optimization :none ClojureScript compiler will compile all
|
||||||
|
;; cljs files in source-paths. To ensure unncessary files
|
||||||
|
;; aren't compiled it would be better to not provide source-paths or
|
||||||
|
;; provide single file but currently this doesn't work for Cljsbuild.
|
||||||
|
;; In future :main alone should be enough to find entry file.
|
||||||
:cljsbuild
|
:cljsbuild
|
||||||
{:builds
|
{:builds
|
||||||
{:client
|
{:client
|
||||||
{:source-paths ["src" "demo" "test"]
|
{:source-paths ["demo"]
|
||||||
|
:watch-paths ["src" "demo" "test"]
|
||||||
:figwheel true
|
:figwheel true
|
||||||
:compiler {:parallel-build true
|
:compiler {:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:main "reagentdemo.dev"
|
:main "reagentdemo.dev"
|
||||||
:output-dir "target/cljsbuild/client/public/js/out"
|
:output-dir "target/cljsbuild/client/public/js/out"
|
||||||
|
@ -53,23 +60,19 @@
|
||||||
:npm-deps false}}
|
:npm-deps false}}
|
||||||
|
|
||||||
:client-npm
|
:client-npm
|
||||||
{:source-paths ["src" "demo" "test"]
|
{:source-paths ["demo"]
|
||||||
|
:watch-paths ["src" "demo" "test"]
|
||||||
:figwheel true
|
:figwheel true
|
||||||
:compiler {:parallel-build true
|
:compiler {:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:main "reagentdemo.dev"
|
:main "reagentdemo.dev"
|
||||||
:output-dir "target/cljsbuild/client-npm/public/js/out"
|
:output-dir "target/cljsbuild/client-npm/public/js/out"
|
||||||
:output-to "target/cljsbuild/client-npm/public/js/main.js"
|
:output-to "target/cljsbuild/client-npm/public/js/main.js"
|
||||||
:asset-path "js/out"
|
:asset-path "js/out"}}
|
||||||
;; add process.env.node_env preload
|
|
||||||
; :npm-deps true
|
|
||||||
:process-shim true}}
|
|
||||||
|
|
||||||
:test
|
:test
|
||||||
{:source-paths ["src" "test"]
|
{:source-paths ["test"]
|
||||||
:compiler {:parallel-build true
|
:compiler {:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:main "reagenttest.runtests"
|
:main "reagenttest.runtests"
|
||||||
:asset-path "js/out"
|
:asset-path "js/out"
|
||||||
|
@ -79,49 +82,52 @@
|
||||||
:aot-cache true}}
|
:aot-cache true}}
|
||||||
|
|
||||||
:test-npm
|
:test-npm
|
||||||
{:source-paths ["src" "test"]
|
{:source-paths ["test"]
|
||||||
:compiler {:parallel-build true
|
:compiler {:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:main "reagenttest.runtests"
|
:main "reagenttest.runtests"
|
||||||
:asset-path "js/out"
|
:asset-path "js/out"
|
||||||
:output-dir "target/cljsbuild/test-npm/out"
|
:output-dir "target/cljsbuild/test-npm/out"
|
||||||
:output-to "target/cljsbuild/test-npm/main.js"
|
:output-to "target/cljsbuild/test-npm/main.js"
|
||||||
; :npm-deps true
|
|
||||||
;; add process.env.node_env preload
|
|
||||||
:process-shim true
|
|
||||||
:aot-cache true}}
|
:aot-cache true}}
|
||||||
|
|
||||||
|
;; Separate source-path as this namespace uses Node built-in modules which
|
||||||
|
;; aren't available for other targets, and would break other builds.
|
||||||
:prerender
|
:prerender
|
||||||
{:source-paths ["src" "demo"]
|
{:source-paths ["prerender"]
|
||||||
:compiler {:main "sitetools.prerender"
|
:compiler {:main "sitetools.prerender"
|
||||||
:target :nodejs
|
:target :nodejs
|
||||||
:output-dir "target/cljsbuild/prerender/out"
|
:output-dir "target/cljsbuild/prerender/out"
|
||||||
:output-to "target/cljsbuild/prerender/main.js"}}
|
:output-to "target/cljsbuild/prerender/main.js"
|
||||||
|
:aot-cache true}}
|
||||||
|
|
||||||
:node-test
|
:node-test
|
||||||
{:source-paths ["src" "test"]
|
{:source-paths ["test/reagenttest/runtests.cljs"]
|
||||||
|
:watch-paths ["src" "test"]
|
||||||
:compiler {:main "reagenttest.runtests"
|
:compiler {:main "reagenttest.runtests"
|
||||||
:target :nodejs
|
:target :nodejs
|
||||||
:parallel-build true
|
:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:output-dir "target/cljsbuild/node-test/out"
|
:output-dir "target/cljsbuild/node-test/out"
|
||||||
:output-to "target/cljsbuild/node-test/main.js"
|
:output-to "target/cljsbuild/node-test/main.js"
|
||||||
:npm-deps false}}
|
:npm-deps false
|
||||||
|
:aot-cache true}}
|
||||||
|
|
||||||
:node-test-npm
|
:node-test-npm
|
||||||
{:source-paths ["src" "test"]
|
{:source-paths ["test/reagenttest/runtests.cljs"]
|
||||||
|
:watch-paths ["src" "test"]
|
||||||
:compiler {:main "reagenttest.runtests"
|
:compiler {:main "reagenttest.runtests"
|
||||||
:target :nodejs
|
:target :nodejs
|
||||||
:parallel-build true
|
:parallel-build true
|
||||||
:source-map true
|
|
||||||
:optimizations :none
|
:optimizations :none
|
||||||
:output-dir "target/cljsbuild/node-test-npm/out"
|
:output-dir "target/cljsbuild/node-test-npm/out"
|
||||||
:output-to "target/cljsbuild/node-test-npm/main.js"}}
|
:output-to "target/cljsbuild/node-test-npm/main.js"
|
||||||
|
:aot-cache true}}
|
||||||
|
|
||||||
|
;; With :advanched source-paths doesn't matter that much as
|
||||||
|
;; Cljs compiler will only read :main file.
|
||||||
:prod
|
:prod
|
||||||
{:source-paths ["src" "demo"]
|
{:source-paths ["demo"]
|
||||||
:compiler {:main "reagentdemo.prod"
|
:compiler {:main "reagentdemo.prod"
|
||||||
:optimizations :advanced
|
:optimizations :advanced
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
|
@ -130,28 +136,27 @@
|
||||||
:stable-names true
|
:stable-names true
|
||||||
:output-to "target/cljsbuild/prod/public/js/main.js"
|
:output-to "target/cljsbuild/prod/public/js/main.js"
|
||||||
:output-dir "target/cljsbuild/prod/out" ;; Outside of public, not published
|
:output-dir "target/cljsbuild/prod/out" ;; Outside of public, not published
|
||||||
:npm-deps false}}
|
:npm-deps false
|
||||||
|
:aot-cache true}}
|
||||||
|
|
||||||
:prod-npm
|
:prod-npm
|
||||||
{:source-paths ["src" "demo"]
|
{:source-paths ["demo"]
|
||||||
:compiler {:main "reagentdemo.prod"
|
:compiler {:main "reagentdemo.prod"
|
||||||
:optimizations :advanced
|
:optimizations :advanced
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
:pretty-print false
|
:pretty-print false
|
||||||
;; :pseudo-names true
|
|
||||||
:stable-names true
|
:stable-names true
|
||||||
:output-to "target/cljsbuild/prod-npm/public/js/main.js"
|
:output-to "target/cljsbuild/prod-npm/public/js/main.js"
|
||||||
:output-dir "target/cljsbuild/prod-npm/out" ;; Outside of public, not published
|
:output-dir "target/cljsbuild/prod-npm/out" ;; Outside of public, not published
|
||||||
:process-shim true
|
:closure-warnings {:global-this :off}
|
||||||
:closure-warnings {:global-this :off}}}
|
:aot-cache true}}
|
||||||
|
|
||||||
:prod-test
|
:prod-test
|
||||||
{:source-paths ["src" "demo"]
|
{:source-paths ["test"]
|
||||||
:compiler {:main "reagenttest.runtests"
|
:compiler {:main "reagenttest.runtests"
|
||||||
:optimizations :advanced
|
:optimizations :advanced
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
:pretty-print false
|
:pretty-print false
|
||||||
;; :pseudo-names true
|
|
||||||
:output-to "target/cljsbuild/prod-test/main.js"
|
:output-to "target/cljsbuild/prod-test/main.js"
|
||||||
:output-dir "target/cljsbuild/prod-test/out"
|
:output-dir "target/cljsbuild/prod-test/out"
|
||||||
:closure-warnings {:global-this :off}
|
:closure-warnings {:global-this :off}
|
||||||
|
@ -159,7 +164,7 @@
|
||||||
:aot-cache true}}
|
:aot-cache true}}
|
||||||
|
|
||||||
:prod-test-npm
|
:prod-test-npm
|
||||||
{:source-paths ["src" "demo"]
|
{:source-paths ["test"]
|
||||||
:compiler {:main "reagenttest.runtests"
|
:compiler {:main "reagenttest.runtests"
|
||||||
:optimizations :advanced
|
:optimizations :advanced
|
||||||
:elide-asserts true
|
:elide-asserts true
|
||||||
|
@ -168,5 +173,4 @@
|
||||||
:output-to "target/cljsbuild/prod-test-npm/main.js"
|
:output-to "target/cljsbuild/prod-test-npm/main.js"
|
||||||
:output-dir "target/cljsbuild/prod-test-npm/out"
|
:output-dir "target/cljsbuild/prod-test-npm/out"
|
||||||
:closure-warnings {:global-this :off}
|
:closure-warnings {:global-this :off}
|
||||||
:aot-cache true}}
|
:aot-cache true}}}})
|
||||||
}})
|
|
||||||
|
|
Loading…
Reference in New Issue