Forum Discussion

kath patterson's avatar
kath patterson
Iron Contributor
Aug 22, 2017

Framework webpart - using splcomponentoader.loadCss and assumptions on permitted domain requests

playing around with the guidance for loading external CSS for jquery, i notice an irritating gotcha.

 

If you follow one of the guidance notes and load jquery from the node-modules you might notice that when you ship the app to the app catalog that you only see your CDN domain as an allowed external domain request.

           "externals": {
                    "jquery":"node_modules/jquery/dist/jquery.min.js",
                    "jqueryui":"node_modules/jqueryui/jquery-ui.min.js"
this seems to have some unexpected consequences.

If you have spcomponentloader calling CSS from domain code.jquery.com then this will not be allowed and the css will not appear when you deploy it to SPO but will work fine in the local workbench.

IF you change the external statement to bring jquery from CDN at code.jquery.com (same place where you are going to use LoadCss then

Now re-package and ship the app to the app catalog you will see both Code,jquery and your CDN domain as allowed external domain request.

 

 

 

 

 

 

 

Now your spComponentLoader statement will work.

No doubt there is much I am missing as a newbie but looks like some assumptions around implicit external domains.

No RepliesBe the first to reply

Resources