@@ -27,17 +27,19 @@ class OutputManager extends HTMLManager {
27
27
// Define our own custom module loader for Shiny
28
28
const shinyRequireLoader = async function ( moduleName : string , moduleVersion : string ) : Promise < any > {
29
29
30
- // shiny provides a shim of require.js and also sets `define.amd=false` to
31
- // allow <script>s with anonymous define()s to be loaded without error.
32
- // Note that, when anonymous define()s are used, the shim will leverage the
33
- // data-requiremodule attribute to determine the module name.
30
+ // shiny provides a shim of require.js which allows <script>s with anonymous
31
+ // define()s to be loaded without error. When an anonymous define() occurs,
32
+ // the shim uses the data-requiremodule attribute (set by require.js) on the script
33
+ // to determine the module name.
34
+ // https://github.com/posit-dev/py-shiny/blob/230940c/scripts/define-shims.js#L10-L16
34
35
// In the context of shinywidgets, when a widget gets rendered, it should
35
- // include another <script> tag that does `require.config({paths: {...}})`
36
- // to map the module name to the URL of the widget's JS file.
36
+ // come with another <script> tag that does `require.config({paths: {...}})`
37
+ // which maps the module name to a URL of the widget's JS file.
37
38
const oldAmd = ( window as any ) . define . amd ;
38
39
39
40
// This is probably not necessary, but just in case -- especially now in a
40
41
// anywidget/ES6 world, we probably don't want to load AMD modules
42
+ // (plotly is one example of a widget that will fail to load if AMD is enabled)
41
43
( window as any ) . define . amd = false ;
42
44
43
45
// Store jQuery global since loading we load a module, it may overwrite it
0 commit comments