Monday, March 26, 2018

Updated Modern Script Editor Web Part with fix for AMD modules and exposing _spPageContextInfo


The web part haven’t change much, but the following configuration options are now available:

  • Keep or remove padding on the web part zone – useful if you have script which does not output any markup.
  • Set the _spPageContextInfo variable – useful if you have old scripts using this variable on classic SharePoint pages.

I have also fixed the code so that it won’t fail when loading AMD module scripts – meaning the scripts will not detect themselves as module scripts, but load globally instead.

You can get the code from


  1. Want to thank you for your efforts in this. This part is a life saver!

  2. Awesome part! I'm having issues with huge white spaces on the right side of the page using the part on modern pages. Tried with team site and communication sites template.

    1. Can you give a sample with screenshot in edit mode, and log it as an issue on github. Makes it easier to track. And tag @wobba in the issue.

  3. Mikael, I've uploaded the web part to SPOL (Office 365) but when I try to add it to site content I get an "Invalid App ID:". I am a site collection admin but not the Office 365 administrator. How can I fix this?