Drop AMD support from bundle header #7229
Merged
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.
Closes #7228.
Plotly.js bundles used to have a UMD header which supports various contexts including "synchronous" module system known as
CommonJS
as well as "asynchronous" module system called AMD.By introduction of native ES6 import in new browsers as well as modern
node.js
runtimes; which is now the standard way of loading "asynchronous" modules,RequireJS
which is an implementation of AMD is no longer under active development. See requirejs/r.js@2.3.6...2.3.7In this context keeping the AMD support as part of the header we add to the
esbuild
bundle here could potentially break pages whenRequireJS
is loaded to the page.To avoid this situation, it is suggested that we remove the AMD part of the header from the bundles so that the bundle could successfully be loaded via script tags both synchronously and asynchronously using CJS
require
and ESMimport
commandsExamples of asynchronous loading
Example of synchronous loading
@plotly/plotly_js