-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Ensure AMD headers of dependencies aren't kept in bundle #7367
Conversation
I don’t think this is an issue with how esbuild/Rolllup handle CommonJS (i.e., In my experience, switching to an entirely new bundler for a specific issue like this isn’t worth it. Bundlers are complex, and overhauling one for minor "better" defaults from another can lead to more problems than it solves. There are always trade offs. For instance, Rollup can require multiple third-party plugins to match esbuild’s baseline functionality. |
Thanks a lot for correcting me on the explanation @manzt! |
Thanks for tracking down the issue! |
@iisakkirotko Thank you for the PR! This actually fixes plotly/plotly.py#5027! I just tested locally |
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.
Tried this out locally and it's working great! Thanks again for this PR @iisakkirotko :D
Thanks @iisakkirotko for the PR. |
Hi!
Recently an issue with using Plotly to render visualizations in our framework, solara was brought to our attention. Because we use some architecture from old jupyter notebook versions together with require.js, plotly.js fails to load. This turns out to be because, despite support for AMD headers in
the plotly.js bundleplotly.js itself being removed in #7229, checks of the formare still
added toincluded in the plotly.js bundle by esbuild from plotly's dependencies (as can be seen in the files indist/
). For example, indist/plotly.js
, these checks are present through 24 different dependencies.I think the ultimate cause of the headers still being present is esbuild not properly handling commonJS modules (see evanw/esbuild#1348). The solution here comes from manzt/anywidget#369 (comment).For a better explanation take a look at the comment below (#7367 (comment)).A potentially better solution might be to migrate from esbuild to rollup, which does handle commonJS modules properly, however that could prove to be more laborious. If that is your preferred solution, let me know - I'm more than happy to lend a hand!
cc: @maartenbreddels, @manzt
Keeping these here as a reminder to myself:
After opening a pull request, developer:
1010_fix.md
or1010_add.md
insidedraftlogs
folder as described in this README, commit it and push.git push -f
) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please fetchupstream/master
and "merge" with master instead of "rebase".