Script Editor Webpart (SEWP) now Available for the SharePoint Framework #SPFx – Sort of

During the March 14th, 2017 SharePoint PnP Monthly Community Call, Mikael Svenson introduced a SharePoint Framework (#SPFx) webpart he recently created. Essentially, the SPFx webpart provides an immediate replacement of the current tool many of us have built a love-hate relationship with, the Script Editor Webpart (SEWP).

The March 2017 PnP release includes Mikael’s new webpart, one he is calling a “Script editor web part for modern pages built in React“. He created a wrapper within a SPFx webpart using React as the rendering engine to include/trigger our own custom JavaScript that can be embedded in the webpart, unique to each webpart usage.

How to Get Started

To learn more, check out the March 2017 Community call recording, or see the sample page directly at GitHub.

A joyous day or a moment of despair?

That is the question many are asking, and it spawned a good thread that I suggest you read. Pat Miller wrote a summary of his thoughts on an SEWP for the framework and even addressed why Microsoft didn’t include this already within the framework itself. My primary takeaway is that Microsoft does not want to condone the inclusion of custom JavaScript at the author level. That should be left to the developers where a consistent editing experience, with rails (ah, Microsoft, and their rails), may be maintained.

I get it. I can’t say I disagree, but unfortunately I also see why a SPFx webpart such as Mikael’s will be used by a great many SharePoint projects. I say “unfortunate” as I believe that with the power and customization ability the framework provides, any JS needed should be embedded by the developer directly in the code. I am not going to say I will never use a framework ready SEWP, nor do I admit that I wasn’t already tinkering with the idea of creating a similar webpart. But I would ask that in general, consider such a webpart in the new Framework world as one of your last options. It should not be your go-to Swiss army knife.

My Recommendations

As my buddy Stefan Bauer commented on Pat’s post, it is time to let the SEWP go. I would go further by comparing the SEWP with our dependence on the InfoPath. New processes will take its place and over time older “hacks” need to be moved out of our toolbox. Mikael’s webpart is going to be a crutch for many transitioning to the framework. I get it, but let’s learn and use the new technologies, and you will find you won’t need shims.

What are your thoughts? Have you already downloaded the webpart and pushed it to production? Or will you stay away from such a tool like the plague? Let me know.


  1. Joe Beaton says:

    Modern and yet it utilizes iFrames … really?

  2. After much messing and re-deploying, i FINALLY got this up on my site and able to add as a web part on modern pages…


    When I add the script (any script) it simply disappears and does not save.

  3. Manohar Nikkam says:


    Will it work in IE11 and modern communication site pages?

  4. Walter Westinghouse says:

    I don’t see what’s so “modern” about the new SP experience. I feel like I am using a stripped down version of SP 2003.

    • In general, yes, this webpart allows you to add custom javascript directly into your modern SharePoint experiences. This is not the ideal way of doing this though, you should be looking at SharePoint Framework webparts or extension for more safe code injection.

  5. No Sun Beach says:

    Any chance MSFT is going to introduce a SEWP app of their own? If they did it would be great if it had a nice large edit window and be more of a built in IDE with intelisense and trace features.

    • I do not know, but my expectation is that they will not. A SEWP gives back full control of the DOM to developers, and that isn’t exactly the route MS is looking to take SharePoint development. That being said, SPFx extensions give us almost the same control as SEWP’s, so well, yeah, kind of?

Speak Your Mind