Forum Discussion
Sharepoint framework > reference to custom javascript
After a day of searching and testing, i found this:
https://blog.mastykarz.nl/bundling-external-frameworks-sharepoint-framework-client-side-web-parts-bad-idea/
Looks like my idea of bundling my javascripts file in the webpart is not the best approach. I know put them on my Sharepoint site (site assets) and referenced them in the "config.json" file. No more build errors so we are getting somewhere.
However, suppose I want to distribute my webpart to different tenants, what might be the best place to put my .js files? Azure somewhere? Or is there a better solution?
- Jun 13, 2017
Hi Mike Jansen,
You could put those scripts anywhere ( as long as they are accesible).
Have you looked at the Azure CDN?
- Jun 13, 2017
Is there a reason why your not just migrating your scripts to TypeScript?
Something like this is easy to implement and closer to where you should want to be:
export default class MyFunctionsTurnedIntoAClass { public oldfunction1() { .... } public oldfunction2() { .... } .... }- Mike JansenJun 13, 2017Iron Contributor
Yes ;-)
This is my first test and I am not familiar with Typescript. What I try to do is get my test working and then step-by-step convert it to typescript.
- Mike JansenJun 13, 2017Iron Contributor
Pieter Veenstra not yet, thanks for the suggestion.
For the moment, I'm struggeling to get it working. ;-)
I use a "$(document).ready" in my .js file. Looks like this is not executed...