Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Declined
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None

      Description

      The reader features for .cljc files is currently hard coded to #{:cljs} and Clojure will use :clj. With the intent being that host-specific features can be chosen at read-time. Given that there are a variety of different JS host platforms it would be useful to allow setting build-specific reader features so that builds targeting node can use different code than using the browser.

      We can not always rely on the Closure Compiler eliminating all the code for us and we currently have no other way to get conditional requires.

      Kevin Lynagh described his use-case here: https://gist.github.com/lynaghk/0608a43f173558b6fcf30c3be53d77dd

      I had a very similar use case in mind for conditional requires related to excluding some code from a node.js targeted build for doing SSR that otherwise should use the same code as the browser uses.

      My suggestion would be to add :reader-features #{:kw1 kw1} to the compiler options which will be added to the default :cljs at read-time.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              thheller Thomas Heller
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: