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

[BUG]: Using @bokeh/bokehjs with Node and Webpack #10228

Closed
sgee107 opened this issue Jun 24, 2020 · 2 comments
Closed

[BUG]: Using @bokeh/bokehjs with Node and Webpack #10228

sgee107 opened this issue Jun 24, 2020 · 2 comments

Comments

@sgee107
Copy link

sgee107 commented Jun 24, 2020

I've been working through a custom project that uses webpack with npm, react, and babel to bundle my javascript code. I've been trying to use bokeh to include some analysis graphics in a React component, but I've been coming across an issue that seems to have been resolved in a create-react-app application with no help toward my current setup.

That conversation can be found here.
https://discourse.bokeh.org/t/node12-import-error-bokeh-2-0/5061/10

Stack Trace of my Issue

image

There are two issues here. One, the internal bokeh styling isn't being resolved for some reason, and two, even after specifying in my webpack configuration to transpile the bokeh package using the plugins specified in other issues, it is still unable to load.

The question really is am I missing something? Are there any intermediate steps to take other than installing bokeh using npm and bundling it with webpack?

Just for reference, here are my version numbers.
Node: 14.4.0
NPM: 6.14.5
@bokeh/bokehjs: 2.1.0
Webpack: 4.43.0
@babel/core: 7.9.0

All on Windows 10

The bug is recreated with both Firefox and Chrome.

Here is where that issue comes from.

import * as Bokeh from '@bokeh/bokehjs'

class BokehSample extends React.Component {
    handlePlot1 = () => {
      fetch('/plot1').then((resp) => Bokeh.embed.embed_item(resp.data, 'testPlot'))
    }

The webpack configuration is pretty straight forward. I’m using css-loader and style-loader to load my css and the following code to transpile the package.

      {
        test: /\.(js|jsx)$/,
        loader: 'babel-loader',
        exclude: /node_modules\/(?!@bokeh\/)/,
      },

Any help on this is greatly appreciated.

This issue is linked to a conversation started in the link below.
https://discourse.bokeh.org/t/using-bokeh-bokehjs-with-node-and-webpack/5818

@sgee107 sgee107 added the TRIAGE label Jun 24, 2020
@mattpap
Copy link
Contributor

mattpap commented Jun 24, 2020

There are two issues. One is related to issue #10172, which was fixed in bokeh 2.1.1. The other is export * as syntax, that still may not be supported in babel, in which case you will need an extension of some sort (the solution seems to be in the linked discourse thread, but I didn't test that).

@sgee107
Copy link
Author

sgee107 commented Jun 25, 2020

I just wanted to link back to the discourse with a solution for the issue. Thanks for the help.

https://discourse.bokeh.org/t/using-bokeh-bokehjs-with-node-and-webpack/5818/4

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

No branches or pull requests

2 participants