Search code examples
sharepoint-onlinespfx

Sharepoint Online every SPFx web parts get this error : Something went wrong -> Mismatched anonymous define() module


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". 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)...

I redeployed the packages but nothing change.


Solution

  • 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"/>-->