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

Add :reload Support #343

Open
athomasoriginal opened this issue Nov 22, 2023 · 4 comments
Open

Add :reload Support #343

athomasoriginal opened this issue Nov 22, 2023 · 4 comments

Comments

@athomasoriginal
Copy link

athomasoriginal commented Nov 22, 2023

Is your feature request related to a problem? Please describe.

I would like to run nbb from a JS program which is itself running in a "watch loop". The blocker is that dependencies of the nbb scripts won't reload when changes are made to them.

Describe the solution you'd like

I'm not opinionated about the solution, but it sounds like adding support for :reload may resolve this issue.

Describe alternatives you've considered

nbb seeing a file was modified and reloading the namespace accordingly (but this is a naive approach and may not be the responsibility of nbb itself)

Additional context

see eleventy-test-cljs for a "minimal" repro of the problem. Also refer to the original slack thread.

@eval
Copy link
Contributor

eval commented Jul 29, 2024

Running into this issue as well. Any ideas @borkdude ?

@borkdude
Copy link
Collaborator

Sure, :reload support can be added. Do you want me to look into this, or do you want to have any guidance?

@eval
Copy link
Contributor

eval commented Jul 29, 2024

Pointers would be nice. I guess here's where the magic should happen.... I read dev.md - what are the options to do interactive dev? (using Cider).

@borkdude
Copy link
Collaborator

Yes. If the namespace is already loaded, which is discovered here:

(if (sci/eval-form (store/get-ctx) (list 'clojure.core/find-ns (list 'quote libname)))

then we just handle the aliases etc, but don't reload the namespace. I think right there the :reload should be handled.

Note that :reload affects all the namespaces in a require, not just the libspec you write it after.

I don't use CIDER for developing nbb, just bb dev and loading a script on the command line via cli.js and writing tests.

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

No branches or pull requests

3 participants