Skip to content

Make base/js/dialog conditional in webpack #298

Open

Description

@gerrymanoim

Right now the nbextension and the labextension for qgrid are different.

The nbextension (installed via pip) contains (in local file nbextensions/qgrid/index.js) define(["@jupyter-widgets/base","base/js/dialog"].... Voila, when configured to server local nbextensions, will try to serve that local file, but since base/js/dialog is provided by the classic notebook and isn't there in Voila, you get an error. If you're offline, game over, qgrid won't work. If you're online, Voila will fallback to unpkg.com, in which case it's actually getting the labextension code instead, which then works.

This is coming in via https://github.com/quantopian/qgrid/blob/master/js/webpack.config.js#L63 which was added b3f8379#diff-69efad4a1399d8cd8a26a3771ae156df.

Is there a way for webpack to conditionally link to externals? We do a conditional requires at https://github.com/quantopian/qgrid/blob/master/js/src/qgrid.widget.js#L11. What would we check to make sure we can load base/js/dialog?

Longer discussion thread at: #291

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions