How to Load External JS or CSS Files in a PowerApps Component Framework (PCF) Control
When adding components into your PCF control, the input parameter container is used in the init() method. This is the main component control that will receive our custom DOM element. We create a custom container using DOM methods, then append our custom container_container with our HTML components to it. Based on our sample index.html from the screenshot above, if we were to add that div element with id=”app”, then we would need to do this:
We apply the same principle when referencing our JS and CSS files into the head element. Based on the index file, we know that external references are just script and link elements with some attributes. We will create our script or link elements with DOM methods. After that, its all about getting the head element and appending our references. This will get loaded when our PCF component gets initiated.