wolfram-notebook-embedder icon indicating copy to clipboard operation
wolfram-notebook-embedder copied to clipboard

Webpack v4 jsonpFunction conflict

Open portokallidis opened this issue 4 years ago • 2 comments

This is to inform people who use webpack in their apps. Webpack build configs with the default jsonpFunction name will not be able to use this library. You will see something like this: image

Solution Modify your webpack output config like this:

{
   "output":{
      "jsonpFunction":"myAppJSONPcallback",
      "library":"myApp"
   }
}

Recommendation for Wolfram You could apply the same config at your end so that this won't be an issue for others

portokallidis avatar Jul 08 '21 13:07 portokallidis

Not sure what we can do on the library's end to avoid this. Note that we're using rollup.js for bundling the library, not webpack.

poeschko avatar Oct 04 '21 09:10 poeschko

Sorry i havent put much effort in explaining the above use case. It has nothing to do with the way this library is built.

I was referring to the bundled code in the Wolfram Public Cloud and the Wolfram Enterprise Private Cloud. If you integrate the notebook embedder lib in a real life application which is bundled with Webpack then its most likely that it will conflict with the code fetched from Public Cloud or EPC (whatever is the source of the cloud notebook) e.g. here is a sample js file fetched when trying to embed an example notebook from the public cloud.

Anyone trying to incorporate this lib into their apps will eventually run into this issue if they use Webpack and havent changed the default jsonp callback configuration.

This comment is to help people overcome this issue because at first we were clueless on how to debug this or recommend Wolfram to update their webpack configuration to make the integration easier for others.

So the conflict arises due to the use of the default jsonp callback function name.

I hope i gave a better picture now

portokallidis avatar Oct 04 '21 09:10 portokallidis