☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Requiring a module from CustomJS Callback

Community Support
mccarthyryanc
mccarthyryanc

I’m new to javascript and have a situation where I’d like to use math.js from within a CustomJS callback. What steps do I need to take to hit this dependency? I’ve installed via npm, but simply calling require("mathjs") from the CustomJS source doesn’t work:

Error: Cannot find module ‘mathjs’

``

My guess is that I’m missing something simple about javascript…

⌁   Link to post
Mateusz_Paprocki2
Mateusz_Paprocki2

Hi,

···

On Thu, May 17, 2018 at 8:04 PM, mccarthyryanc@gmail.com wrote:

I’m new to javascript and have a situation where I’d like to use math.js from within a CustomJS callback. What steps do I need to take to hit this dependency? I’ve installed via npm, but simply calling require("mathjs") from the CustomJS source doesn’t work:

Error: Cannot find module ‘mathjs’

``

My guess is that I’m missing something simple about javascript…

the simplest solution would be to just include a <script src="path/to/math.js> in the HTML document (possibly use a CDN) and then reference math.js from a CustomJS callback by using mathjs global. If you want to to include math.js as a module (which require() implies), then you would have to create a custom bokehjs module bundle, which, I think, is an overkill in this scenario. Obviously a lot depends on what exactly is the goal. If you just want to make it work, then the former solution should be much more straight forward to work out.

Mateusz

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cce04cd6-3f82-4b66-8f53-977eae09c09b%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled