Newclique
Newclique

Reputation: 494

Can I use webpack.ProvidePlugin to add a reference to MicrosoftAjax.js?

I am just starting to try to figure out how to reference some external libraries using webpack.config.js. I need to reference the SharePoint libraries SP.js, SP.Runtime.js and SP.Taxonomy.js inside an Angular 8 application. The SP scripts call Type.RegisterNamespace. "Type" is a class inside of MicrosoftAjax.js. I want to understand how I can add all of these as a plugin so everything compiles and plays nice inside of Angular. If I can accomplish this it will open up all of the SP remoting calls (REST, basically) that a fully stand-alone Angular app can use to talk directly to SharePoint.

I added the script references to my angular.json file but that's not enough to get everything working. Also, MicrosoftAjax.js needs to load and initialize before the SP.js files start to run. If this is possible in Angular 8/9 (calling all Angular gurus out there!) I will be so thrilled.

I've used the @pnp/sp library to accomplish most of the things I need to but that library does not support interacting with 100% of the SharePoint environment. It's the SP.Taxonomy namespace that I really need to get at but without the MicrosotAjax library I don't think I can get the libraries to function.

Upvotes: 0

Views: 144

Answers (0)

Related Questions