-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Switch to use anywidget #4663
Switch to use anywidget #4663
Conversation
{ | ||
"scripts": { | ||
"build": "esbuild --bundle --alias:plotly.js=plotly.js/dist/plotly --format=esm --minify --outfile=../plotly/bundle.js widget.ts", | ||
"watch": "npm run build -- --watch --sourcemap=inline", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sourcemaps will make it easier to debug when developing the widget using the browser developer tools.
@@ -0,0 +1,17 @@ | |||
{ | |||
"scripts": { | |||
"build": "esbuild --bundle --alias:plotly.js=plotly.js/dist/plotly --format=esm --minify --outfile=../plotly/bundle.js widget.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the --minify
and --alias
flags. minify
makes the final bundle smaller.
The alias here is to make the import nicer for typescript type checking types (tsc), while esbuild needs to point to the actual files (./dist).
Co-authored by @manzt! This updates the logic for the
FigureWidget
to rely on anywidget.A quote about anywidget from the documentation for context:
This will not affect the
go.Figure
class. High level explanation of the difference between usinggo.Figure
andgo.FigureWidget
:go.Figure
: The chart generated by this object will be interactive on the client side. For many purposes, this is all a user needs to do with a chart. The interactions are things like zooming in, or any of the various operations in the toolbar.go.FigureWidget
: The difference here is that the figure is interactive on the server side as well.