1

I have SharePoint online sites and some spfx web parts. These sites are created with publishing site templates and web parts have been working for months. I rarely got this error "something went wrong". But when I refresh the pages then the error goes away. Every web part gets the same error. Even if I use an empty web part it gives the same error. But in last two weeks, that error increased a lot. Is there any update for publishing sites? How can I remove this error?

Something went wrong

If the problem persists, contact the site administrator and give them the information in Technical Details.

TECHNİCAL DETAİLS ERROR:

Mismatched anonymous define() module: function(e,f,d){"use strict"; function i(e,t)...

enter image description here

5
  • based on this: stackoverflow.com/a/23467090/8894067 you might be loading some dependencies multiple times. How did you develop your webparts? there are 2 ways of adding an external library. You can include it in the bundle or just load it from a cdn(or sharepoint assets library). learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/basics/…
    – jimas13
    Nov 17, 2022 at 20:37
  • 1
    Thanks @jimas13 . I didn't use cdn. But I think main reason is different. Because even if I use empty web part it gives me the same error. If I add this web part to a site which is community site, it works every time perfectly. It's somehow related with publishing page template. But it is not stable. It gaves this error sometimes. While I'm debugging this error never comes. Nov 18, 2022 at 4:32
  • have you tried deploying the webpart to a site that has the publishing features disabled?
    – jimas13
    Nov 18, 2022 at 8:40
  • I deployed globally. It works on a community site. Maybe other classic site templates will give the same error. I don't know what changed within the last two weeks from Microsoft's side. Nov 18, 2022 at 11:14
  • We're having the same issue on a similar setup. Can you please let me know how you were able to identify which JS file reference to remove? thanks!
    – Mohan
    Oct 10, 2023 at 2:29

1 Answer 1

1

Finally I found the cause. I use a publishing portal site template with a custom master page. There are some javascript references in the header. When I removed references, the error has gone. The final solution is to add this code

<!--SPM:<SharePoint:Scriptlink language="javscript"
name="https://....js"
runat="server" Localizable="false"/>-->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.