Ensure AMD headers of dependencies aren't kept in bundle #7367
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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".