What is the correct (generic) way to generate a path (URL) to a static resource that an extention has?

I am developing jupyterlab-box-drive.

I need to open a modal dialog for auth to Box.com .

However, I don’t know the correct (generic) way to generate a path (URL) to static html for that.

In the following two cases, the path where the extension static resource is placed is different, and if I choose one of them, one will result in 404 not Found.

  • JupyterLab: ../lab/extensions/jupyterlab-box-drive/static/auth.html
  • JupyterLite: ../extensions/jupyterlab-box-drive/static/auth.html

jupyterlab-box-drive is intended to run on JupyterLite, but I would like to run it on JupyterLab if possible.

Is this topic relevant? Static content for jupyterlab extension

There’s a lot of information in the cross-posted issue… looks like there are some more cross-posted threads here. Please try to consolidate your inquiry, and actually try some of the approaches recommended instead of just making more issues and posts.

In a nutshell, some options:

  • use webpack 5 assets
  • use the crusty old file-loader
    • still works
  • use webpack-copy-plugin
  • use some out-of-band approach, such as a PageConfig setting, as populated in:
    • jupyter-lite.json
    • a serverextension

I’m sorry @bollwyvl

I didn’t realize that these two problems were the same.

  • Put assets/resources into the wheel
  • Get path to deployed assets/resources (pip install intervenes)

I assumed that the wheel(and pip install) separated the two and that they were unrelated, and I couldn’t think of other possibilities.

I tried using asset module etc.
and I got an error :frowning:
Error: Cannot find module '@/assets/auth.html'

This is a maze for backend engineers…

I did a temporary hack, but I know this isn’t a good way to do it.