question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] Target ES5/ES6 with BokehJS

See original GitHub issue

Is your feature request related to a problem? Please describe. Yes, I am unable to use BokehJS v2.2.3 in legacy webpack projects as BokehJS makes use of the ES2020 syntax export ns from syntax in the exported file build/js/lib/index.js which is not widely supported. See below:

export * as embed from "./embed";
export * as protocol from "./protocol";
export * as _testing from "./testing";

Previous BokehJS version 2.0.2 did not have this issue.

Describe the solution you’d like Target a lower ECMAScript language spec when publishing BokehJS, i.e. ES5/ES6.

Describe alternatives you’ve considered I’ve considered the following:

  • updating our legacy projects webpack/babel configs but this has negative impacts on other packages and tooling used in our project.
  • remaining on old version 2.0.2 but our projects requires the use of bug fixes in v2.2.3.

Currently we are attempting to work around this by copying bokehjs directory out of node_modules and modifying the syntax in build/js/lib/index.js to use the following:

import * as embed from './embed';
import * as protocol from './protocol';
import * as _testing from './testing';

export { version } from './version';
export { index } from './embed';
export { embed };
export { protocol };
export { _testing };
export { logger, set_log_level } from './core/logging';
export { settings } from './core/settings';
export { Models } from './base';
export { documents } from './document';
export { safely } from './safely';
// # sourceMappingURL=index.js.map

Obviously copying BokehJS out of node_modules this is less than ideal.

Additional context Targeting a more widely used ECMAScript standard will allow for more users to utilize BokehJS and should be easily achievable.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
adaamzcommented, Jul 21, 2021

I use babel but still i get error for this: Uncaught TypeError: Array is not a constructor babel constructs something like this:

var Arrayable = new Kinds.Arrayable();
var Array = item_type => new Kinds.Array(item_type);

which then causes problem when translating reset operator (…) to new Array

Is it possible to not use Array or what is the best way to solve this issue? Has Babel some preset to fix this preset? thx

0reactions
joshuadavidsoncommented, Nov 16, 2022

@mTymoshenko sorry I have not found a way around this. I’ve since moved our team away from Bokeh so I have not tried any of the newer versions or more creative approaches. I guess you could always fork it and fix yourself…

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES5 vs. ES6 in JavaScript - Medium
But ES6 has introduced spread operator(…) to merge objects. But there is a slight difference. The Object.assign() changes the target variable, ...
Read more >
ES5 to ESNext — here's every feature added to JavaScript ...
Let's dive into the specific features added to JavaScript since ES5. ... DOM Event listeners set this to be the target element, ...
Read more >
Developing with JavaScript — Bokeh 2.4.3 Documentation
BokehJS is a client-side library that lets you create interactive plots and applications. It takes care of drawing, rendering, and event handling.
Read more >
Which version of EcmaScript should I use in the TypeScript ...
TypeScript allows converting most of the ES next features to ES3, ES5, ES6, ES2016, ES2017. Of course, you can also target ES Next....
Read more >
ECMAScript 6 compatibility table
Feature name▻ Current browser 98% ES6 Trans‑ piler 25% Trace... Optimisation Optimisation Optimisation Optimi... §proper tail calls (tail call optimisation)▻ 0/2 0/2 0/2 §direct recursionc No...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found