Posts

Showing posts from July, 2024

create spfx with angular, no generators or dependencies, with auto-save

SPFX 1.19,  Angular 18 everything in my git, all tutorial in README, all code included  https://github.com/bresleveloper/angular-spfx/tree/main

define not working with spfx / sharepoint online

 usually when we use modern plugins you will see something like this in the top of the JS file: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).SOMEPLUGINNAME=e()}(this,(function(){"use strict"; //more js code BUT you will see errors like "SOMEPLUGINNAME is not defined", "cannot find module", ect. the reason is that MS overrides so many things and "define" as well, and i am not sure why it fails. BUT all that code wants to find the the "Window" object as named above  globalThis So lets help him and change to  !function(t,e){(t="undefined"!=typeof globalThis?globalThis:t||self).SOMEPLUGINNAME=e()}(this,(function(){"use strict"; //more js code or even just  !function(t,e){ globalThis .SOMEPLUGINNAME=e() } BTW for adding all t...