Trouble using Bokeh.js with webpack + npm

I’m trying to use Bokeh.js in my webpack project, and I’m getting the following messages when I try to import it:

WARNING in ./~/bokehjs/build/js/tree/index.js
26:17-30 Critical dependency: the request of a dependency is an expression

WARNING in ./~/root-require/index.js
16:8-72 Critical dependency: the request of a dependency is an expression

WARNING in ./~/bokehjs/build/js/tree/models/callbacks/customjs.js
28:90-97 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/bokehjs/build/js/tree/models/formatters/func_tick_formatter.js
37:94-101 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./~/packpath/lib/packpath.js
Module not found: Error: Can’t resolve ‘fs’ in ‘/home/user/dev/bokeh-require-test/node_modules/packpath/lib’
@ ./~/packpath/lib/packpath.js 1:9-22
@ ./~/root-require/index.js
@ ./~/bokehjs/build/js/tree/index.js
@ ./index.js

I’ve included a minimal self-contained example that you can clone here: https://gist.github.com/flaviut/18a1da4bad90c362fac664935c8225f6

The steps to reproduce are simply “npm install” to get the dependencies, and “webpack” to attempt to build the project. I’ve tried to delete the dependency on require-root in index.coffee, but to be totally honest, I have no idea how any of that works.

Thank you!

Hi,

···

On Mon, Mar 13, 2017 at 10:58 PM, [email protected] wrote:

I’m trying to use Bokeh.js in my webpack project, and I’m getting the following messages when I try to import it:

WARNING in ./~/bokehjs/build/js/tree/index.js
26:17-30 Critical dependency: the request of a dependency is an expression

WARNING in ./~/root-require/index.js
16:8-72 Critical dependency: the request of a dependency is an expression

WARNING in ./~/bokehjs/build/js/tree/models/callbacks/customjs.js
28:90-97 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/bokehjs/build/js/tree/models/formatters/func_tick_formatter.js
37:94-101 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./~/packpath/lib/packpath.js
Module not found: Error: Can’t resolve ‘fs’ in ‘/home/user/dev/bokeh-require-test/node_modules/packpath/lib’
@ ./~/packpath/lib/packpath.js 1:9-22
@ ./~/root-require/index.js
@ ./~/bokehjs/build/js/tree/index.js

you’re using wrong entry point. This one is for node. For web you should use main.js.

@ ./index.js

I’ve included a minimal self-contained example that you can clone here: https://gist.github.com/flaviut/18a1da4bad90c362fac664935c8225f6

The steps to reproduce are simply “npm install” to get the dependencies, and “webpack” to attempt to build the project. I’ve tried to delete the dependency on require-root in index.coffee, but to be totally honest, I have no idea how any of that works.

Mateusz

Thank you!

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/baa5ebab-b938-4576-ae3a-738a62880d63%40continuum.io.

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

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work; there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.
  • In node_modules/bokehjs/build/js/tree/core/ui_events.js, I had to change require(“jquery-mousewheel”) to require(“imports-loader?define=>false!jquery-mousewheel”).
  • This appears to be a problem with jquery-mousewheel, see https://github.com/webpack/webpack/issues/1567 and https://github.com/malihu/malihu-custom-scrollbar-plugin/issues/371.
    But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”
    I’ve updated the gist with the modified code.

Hi,

···

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

Hi,
I’m getting similar issues using bokehjs with npm and webpack. Is webpack now supported with bokehjs?

My errorlog is Bokehjs with npm and webpack errorlog · GitHub

Similar warnings and then resolving errors.

Thanks!

···

On Monday, March 20, 2017 at 8:27:24 AM UTC-7, mateusz.paprocki wrote:

Hi,

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

I’m getting very similar errors to H R trying to import this into my Angular 5 project built with webpack. It’s a shame because this looks like it could be a very nice library if I could get it working. Did anybody figure out the cause of the issue and/or workarounds?

···

On Thursday, 20 April 2017 06:25:08 UTC+10, H R wrote:

Hi,
I’m getting similar issues using bokehjs with npm and webpack. Is webpack now supported with bokehjs?

My errorlog is https://gist.github.com/hatsy/d3fb641cc81f3e4e03d3d2f1658e34af

Similar warnings and then resolving errors.

Thanks!

On Monday, March 20, 2017 at 8:27:24 AM UTC-7, mateusz.paprocki wrote:

Hi,

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

Hi,

···

On Fri, Apr 20, 2018 at 5:09 AM, [email protected] wrote:

I’m getting very similar errors to H R trying to import this into my Angular 5 project built with webpack. It’s a shame because this looks like it could be a very nice library if I could get it working. Did anybody figure out the cause of the issue and/or workarounds?

it would be good to get an updated log, because the referenced E-mail is old. However, those errors are due to bokehjs using multiple roots for JS modules (the default node_modules and one custom path). I’m not sure how this is done in webpack, but here https://stackoverflow.com/questions/47978866/how-can-i-browserify-bokehjs/47993851#47993851 is how it got resolved in browserify. (the parameter name may be different, but semantics should be the same). This should solve most of the errors. If there is anything new, please report. Also, make sure you have bokehjs’ dependencies installed exactly as specified in bokehjs’ package.json.

Mateusz

On Thursday, 20 April 2017 06:25:08 UTC+10, H R wrote:

Hi,
I’m getting similar issues using bokehjs with npm and webpack. Is webpack now supported with bokehjs?

My errorlog is https://gist.github.com/hatsy/d3fb641cc81f3e4e03d3d2f1658e34af

Similar warnings and then resolving errors.

Thanks!

On Monday, March 20, 2017 at 8:27:24 AM UTC-7, mateusz.paprocki wrote:

Hi,

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/57f8e10d-525f-479f-9845-2bacf885aca7%40continuum.io.

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

Hi guys, I hope I am not too late on this but I am getting the same errors with webpack and bokehjs.

Was anyone able to solve the issue?

···

Am Montag, 13. März 2017 23:01:04 UTC+1 schrieb Flaviu Tamas:

I’m trying to use Bokeh.js in my webpack project, and I’m getting the following messages when I try to import it:

WARNING in ./~/bokehjs/build/js/tree/index.js
26:17-30 Critical dependency: the request of a dependency is an expression

WARNING in ./~/root-require/index.js
16:8-72 Critical dependency: the request of a dependency is an expression

WARNING in ./~/bokehjs/build/js/tree/models/callbacks/customjs.js
28:90-97 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/bokehjs/build/js/tree/models/formatters/func_tick_formatter.js
37:94-101 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./~/packpath/lib/packpath.js
Module not found: Error: Can’t resolve ‘fs’ in ‘/home/user/dev/bokeh-require-test/node_modules/packpath/lib’
@ ./~/packpath/lib/packpath.js 1:9-22
@ ./~/root-require/index.js
@ ./~/bokehjs/build/js/tree/index.js
@ ./index.js

I’ve included a minimal self-contained example that you can clone here: https://gist.github.com/flaviut/18a1da4bad90c362fac664935c8225f6

The steps to reproduce are simply “npm install” to get the dependencies, and “webpack” to attempt to build the project. I’ve tried to delete the dependency on require-root in index.coffee, but to be totally honest, I have no idea how any of that works.

Thank you!

I’m sorry, I can’t remember anything. It’s been a while since I’ve worked on that project and I no longer have access to it.

···

On Wed, May 23, 2018, 12:42 irtaza.com via Bokeh Discussion - Public [email protected] wrote:

Hi Flaviu, I hope I am not too late on this but I am having the same issues with webpack and bokehjs. were you able to solve the issue?

Am Montag, 13. März 2017 23:01:04 UTC+1 schrieb Flaviu Tamas:

I’m trying to use Bokeh.js in my webpack project, and I’m getting the following messages when I try to import it:

WARNING in ./~/bokehjs/build/js/tree/index.js
26:17-30 Critical dependency: the request of a dependency is an expression

WARNING in ./~/root-require/index.js
16:8-72 Critical dependency: the request of a dependency is an expression

WARNING in ./~/bokehjs/build/js/tree/models/callbacks/customjs.js
28:90-97 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./~/bokehjs/build/js/tree/models/formatters/func_tick_formatter.js
37:94-101 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

ERROR in ./~/packpath/lib/packpath.js
Module not found: Error: Can’t resolve ‘fs’ in ‘/home/user/dev/bokeh-require-test/node_modules/packpath/lib’
@ ./~/packpath/lib/packpath.js 1:9-22
@ ./~/root-require/index.js
@ ./~/bokehjs/build/js/tree/index.js
@ ./index.js

I’ve included a minimal self-contained example that you can clone here: https://gist.github.com/flaviut/18a1da4bad90c362fac664935c8225f6

The steps to reproduce are simply “npm install” to get the dependencies, and “webpack” to attempt to build the project. I’ve tried to delete the dependency on require-root in index.coffee, but to be totally honest, I have no idea how any of that works.

Thank you!

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

To unsubscribe from this topic, visit https://groups.google.com/a/continuum.io/d/topic/bokeh/yk8vzJ0HVqQ/unsubscribe.

To unsubscribe from this group and all its topics, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/7ae789dd-a214-4ede-948f-504e7cdc6fc6%40continuum.io.

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

Hi Ed, did you find any solution to the problem?

···

Am Freitag, 20. April 2018 05:09:50 UTC+2 schrieb Ed Bordin:

I’m getting very similar errors to H R trying to import this into my Angular 5 project built with webpack. It’s a shame because this looks like it could be a very nice library if I could get it working. Did anybody figure out the cause of the issue and/or workarounds?

On Thursday, 20 April 2017 06:25:08 UTC+10, H R wrote:

Hi,
I’m getting similar issues using bokehjs with npm and webpack. Is webpack now supported with bokehjs?

My errorlog is https://gist.github.com/hatsy/d3fb641cc81f3e4e03d3d2f1658e34af

Similar warnings and then resolving errors.

Thanks!

On Monday, March 20, 2017 at 8:27:24 AM UTC-7, mateusz.paprocki wrote:

Hi,

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

Hi Matequsz,

the error logs are still the same as those mentioned by H R: https://gist.github.com/hatsy/d3fb641cc81f3e4e03d3d2f1658e34af

I am trying to embed bokehjs in a jupyter lab extension. But importing it by const Bokeh = require(“bokehjs”); causes the same errors as mentioned above.

···

Am Montag, 23. April 2018 19:47:53 UTC+2 schrieb mateusz.paprocki:

Hi,

On Fri, Apr 20, 2018 at 5:09 AM, [email protected] wrote:

I’m getting very similar errors to H R trying to import this into my Angular 5 project built with webpack. It’s a shame because this looks like it could be a very nice library if I could get it working. Did anybody figure out the cause of the issue and/or workarounds?

it would be good to get an updated log, because the referenced E-mail is old. However, those errors are due to bokehjs using multiple roots for JS modules (the default node_modules and one custom path). I’m not sure how this is done in webpack, but here https://stackoverflow.com/questions/47978866/how-can-i-browserify-bokehjs/47993851#47993851 is how it got resolved in browserify. (the parameter name may be different, but semantics should be the same). This should solve most of the errors. If there is anything new, please report. Also, make sure you have bokehjs’ dependencies installed exactly as specified in bokehjs’ package.json.

Mateusz

On Thursday, 20 April 2017 06:25:08 UTC+10, H R wrote:

Hi,
I’m getting similar issues using bokehjs with npm and webpack. Is webpack now supported with bokehjs?

My errorlog is https://gist.github.com/hatsy/d3fb641cc81f3e4e03d3d2f1658e34af

Similar warnings and then resolving errors.

Thanks!

On Monday, March 20, 2017 at 8:27:24 AM UTC-7, mateusz.paprocki wrote:

Hi,

On Fri, Mar 17, 2017 at 4:33 PM, [email protected] wrote:

you’re using wrong entry point. This one is for node. For web you should use main.js.

Like import * as Bokeh from “./node_modules/bokehjs/build/js/tree/main”;? It’s a little ugly, and it still doesn’t quite work;

to deal with ugliness like this, we usually make aliases in package.json, so that we use the desired entry point an still can write import * as Bokeh from “bokeh”. All this is unavoidable give the state of the art of JS tooling.

there’s a couple more issues that I needed to fix:

  • In node_modules/bokehjs/build/js/tree/core/util/proj4.js, I had to change require(“proj4/lib/Proj”) to require(“proj4/lib/Proj”).default, and require(“proj4/lib/defs”) to require(“proj4/lib/defs”).default.
  • Since proj4/lib/Proj exports a default, shouldn’t import * as proj4 from “proj4/lib/core” actually be import proj4 from “proj4/lib/core” so that the default is imported? I’m very new to this ES6 stuff, so please excuse me if I misunderstand how it works.

proj4 recently switched to ES modules and our build doesn’t support this, thus in bokeh 0.12.5-dev we pinned proj4 at version < 2.4. If you follow this, then no source code modifications will be necessary. Or you can actually use dev version if you want (just don’t rely on master, but use dev tags).

I presume this is UMD at its best. This is an ongoing struggle to get universal modules behave.

But I want to use the Bokeh.Plotting API, and even after fixing those things, I still don’t get access to it:

console.log(Bokeh)

  1. Object
  2. Models:(name)
  3. default:Object
  4. embed:Object
  5. index:Object
  6. logger:Logger
  7. safely:(fn, silent)
  8. set_log_level:(level)
  9. version:“0.12.4”

Plotting API is available as require(“api/plotting”). We don’t pollute Bokeh.Plotting by default, because that API comes in a different bundle (bokeh-api). node.js entry point has code handling this, so you may want to check bokehjs/src/coffee/index.coffee.

Summing up, given the tooling, complexity of our build and the fact that we never used bokehjs under webpack, issues you have are not unexpected. Let us know if you have any other issues.

Mateusz

I’ve updated the gist with the modified code.

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/de498fde-00d4-4d88-87a7-9bddb64f36ef%40continuum.io.

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

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 [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/57f8e10d-525f-479f-9845-2bacf885aca7%40continuum.io.

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