SPComponentLoader error in SPFx application extension
Category
- [x] Bug
I am using SPComponentLoader to load SP.js in SPFx application customizer:
SPComponentLoader.loadScript('/_layouts/15/init.js', {
globalExportsName: '$_global_init'
}).then( () =>{ console.log("init.js loaded"); } )
The code above works on almost all SharePoint forms & pages except this one page: https://{tenant}.sharepoint.com/site1/Docs/Forms/AllItems.aspx?id=%2Fsite1%2FDocs%2FSubfolder1%2Fsomefile%2Etxt&parent=%2Fsite1%2FDocs%2FSubfolder1
The following error is displayed in the browser console: "Uncaught (in promise) Error: No define call for /_layouts/15/init.js http://requirejs.org/docs/errors.html#nodefine".
Steps to reproduce:
- Upload any *.txt file to the Document library
- click on this file
- Browser window will redirect silently to URL like this: https://{tenant}.sharepoint.com/site1/Docs/Forms/AllItems.aspx?id=%2Fsite1%2FDocs%2FSubfolder1%2Fsomefile%2Etxt&parent=%2Fsite1%2FDocs%2FSubfolder1
- Copy and paste URL in the new browser tab
- The file will be opened in a browser but the error mentioned above will be displayed. Even more, I do not use SPComponentLoader on this page, and navigates to other list using left navigation (silent navigation will occur without reloading the whole browser window), then I will not be able to use SPComponentLoader there as well. The same error will be displayed there.
I am using SharePoint mod environment.
There are similar closed issues: #1180 and #2505, but the fixes do still not work for the mentioned above page.
Kind regards, Yuriy
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
Thank you for your submission, but there isn't enough detail in the issue for us to review & move forward. The new issue template includes sections for you to fill out. Please resubmit your issue and complete the provided sections in the new item template so we can move forward on it refer to our wiki for more information: How to Create Good Issues
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues