Skip to content
Snippets Groups Projects
  • Braden Shepherdson's avatar
    8e298158
    Enable ClojureScript REPL and hot reloading of CLJS code (#34007) · 8e298158
    Braden Shepherdson authored
    This also moves the CLJS output out of `frontend/src/cljs{,_release}` to
    `target/cljs_{dev,release}`. If that causes problems for FE tooling I
    don't know about, it could be moved back.
    
    Hot reloading:
    CLJS changes are hot-reloaded into the running app by Shadow CLJS - no
    action is needed. Note that the UI will not refresh; you usually have to
    click around so the updated MLv2 code gets executed.
    
    Usage of the CLJS REPL:
    - Open the browser (you should see `shadow-cljs: #N ready!` in console)
    - Connect to nrepl on 50655
    - "Select" the `:app` build;
        - https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration
        - Conjure: `:ConjureShadowSelect app`
        - Plain REPL: Eval in CLJ mode `(shadow/repl :app)`
    - Consider running `yarn build-hot:cljs` and `yarn build-hot:js` in
      separate terminals; then when `yarn build-hot:js` crashes you don't
      have to reconnect your REPL.
    - The REPL works beautifully, even loading files outside the :entries
      of the shadow-cljs build like tests!
    
    "Stale" error in browser:
    - This can happen if the webpack bundle is created before the CLJS is
      done building.
    - If you ran `yarn build-hot:cljs` and `:js` separately, let `:cljs`
      finish compiling first.
    - If you see this otherwise: (a) contact Braden so it can be fixed; and
      (b) either restart `build-hot:js` or force webpack to rebuild by
      hitting http://localhost:8080/webpack-dev-server/invalidate
    
    Yarn commands:
    `dev`, `dev-ee`, `build-hot`, and `build-static-viz:watch` all now wait
    for the CLJS build to be complete by watching for files to be generated.
    They should work the same from a user's POV.
    
    (Since the webpack build no longer watches the CLJS output,
    it won't notice the changes and immediately rebuild after the first
    build. This avoids errors on the clean build, or "stale build" messages
    in the app from Shadow CLJS.)
    
    Fixes #32674.
    Enable ClojureScript REPL and hot reloading of CLJS code (#34007)
    Braden Shepherdson authored
    This also moves the CLJS output out of `frontend/src/cljs{,_release}` to
    `target/cljs_{dev,release}`. If that causes problems for FE tooling I
    don't know about, it could be moved back.
    
    Hot reloading:
    CLJS changes are hot-reloaded into the running app by Shadow CLJS - no
    action is needed. Note that the UI will not refresh; you usually have to
    click around so the updated MLv2 code gets executed.
    
    Usage of the CLJS REPL:
    - Open the browser (you should see `shadow-cljs: #N ready!` in console)
    - Connect to nrepl on 50655
    - "Select" the `:app` build;
        - https://shadow-cljs.github.io/docs/UsersGuide.html#_editor_integration
        - Conjure: `:ConjureShadowSelect app`
        - Plain REPL: Eval in CLJ mode `(shadow/repl :app)`
    - Consider running `yarn build-hot:cljs` and `yarn build-hot:js` in
      separate terminals; then when `yarn build-hot:js` crashes you don't
      have to reconnect your REPL.
    - The REPL works beautifully, even loading files outside the :entries
      of the shadow-cljs build like tests!
    
    "Stale" error in browser:
    - This can happen if the webpack bundle is created before the CLJS is
      done building.
    - If you ran `yarn build-hot:cljs` and `:js` separately, let `:cljs`
      finish compiling first.
    - If you see this otherwise: (a) contact Braden so it can be fixed; and
      (b) either restart `build-hot:js` or force webpack to rebuild by
      hitting http://localhost:8080/webpack-dev-server/invalidate
    
    Yarn commands:
    `dev`, `dev-ee`, `build-hot`, and `build-static-viz:watch` all now wait
    for the CLJS build to be complete by watching for files to be generated.
    They should work the same from a user's POV.
    
    (Since the webpack build no longer watches the CLJS output,
    it won't notice the changes and immediately rebuild after the first
    build. This avoids errors on the clean build, or "stale build" messages
    in the app from Shadow CLJS.)
    
    Fixes #32674.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.