Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use :main compiler option if no :require or :init-fns used #143

Closed
wants to merge 1 commit into from

Conversation

Deraen
Copy link
Contributor

@Deraen Deraen commented Dec 20, 2016

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:

  1. :main compiler-option provided and no :require and no :init-fns -> :main is used and Boot-cljs doesn't generate shim namespace
  2. :main compiler-option provided and :require or :init-fns provided -> :main is ignored, shim namespace generated and warning is printed
  3. no :main -> shim namespace is generated

There 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.

@Deraen Deraen mentioned this pull request Dec 21, 2016
@Deraen
Copy link
Contributor Author

Deraen commented Apr 3, 2017

Alternative implementation merged cb51245

@Deraen Deraen closed this Apr 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow :main option
1 participant