WIP: Use :main compiler option if no :require or :init-fns used #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #139
I would like to support using normal ClojureScript compiler-options without Boot-cljs overwriting user provided options. I also don't want to break existing setups.
Proposed logic:
:main
compiler-option provided and no:require
and no:init-fns
->:main
is used and Boot-cljs doesn't generate shim namespace:main
compiler-option provided and:require
or:init-fns
provided ->:main
is ignored, shim namespace generated and warning is printed:main
-> shim namespace is generatedThere is one problem.
Boot-reload and Boot-cljs-repl use
:require
to add their client code automatically to the build.It is possible to update both tasks to use
:preloads
instead, if they detect that condition 1 is true (https://github.com/adzerk-oss/boot-reload/tree/feature/preloads-instead-require, https://github.com/adzerk-oss/boot-cljs-repl/tree/feature/preloads-instead-require).There is however one side-effect of using
:preloads
to load Boot-reload code.Currently Boot-reload client namespace is loaded just after application code, and after any dependencies (Reagent etc.) are loaded. Preload namespaces however are loaded as early as possible, after dependencies of preload namespaces are loaded.
Boot-reload changes the load mechanims Closure uses, and the current version is broken if enabled during initial page load. This can be fixed but this fix has a side-effect that the initial page-load will be slower as files are not being loaded parallel.