0

I am trying to deploy my spfx webpart (not for testing). I am using

gulp clean --ship
gulp build --ship 
gulp bundle --ship
gulp package-solution --ship

but getting that error

<span class="b_a_7caff1a1">[SPLoaderError.loadComponentError]:<br>Failed to load component "d1587168-2126-44f1-bc7d-cfa4cc5108ed" (appWebPart). Original error: Failed to load URL 'https://localhost:4321/lib/webparts/app/loc/en-us.js' for resource 'appWebPartStrings' in component 'd1587168-2126-44f1-bc7d-cfa4cc5108ed' (appWebPart). There was a network problem. Make sure that you are running 'gulp serve' and you have run 'gulp trust-dev-cert'.<br><br>INNERERROR:<br>Failed to load URL 'https://localhost:4321/lib/webparts/app/loc/en-us.js' for resource 'appWebPartStrings' in component 'd1587168-2126-44f1-bc7d-cfa4cc5108ed' (appWebPart). There was a network problem. Make sure that you are running 'gulp serve' and you have run 'gulp trust-dev-cert'.<br>CALLSTACK:<br>Error<br>    at t [as constructor] (https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_0a1c05f5e3bd0bdb1beb2cb00167ccfa.js:1:956938)<br>    at new t (https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_0a1c05f5e3bd0bdb1beb2cb00167ccfa.js:1:1102532)<br>    at Function.e.buildErrorWithVerboseLog (https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_0a1c05f5e3bd0bdb1beb2cb00167ccfa.js:1:1157847)<br>    at Function.e.buildLoadComponentError (https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_0a1c05f5e3bd0bdb1beb2cb00167ccfa.js:1:1153892)<br>    at https://spoprod-a.akamaihd.net/files/sp-client/sp-pages-assembly_en-us_0a1c05f5e3bd0bdb1beb2cb00167ccfa.js:1:1145841</span>

It works fine when I test on workbench though. How can I fix this?

Thanks

  • Try running gulp trust-dev-cert and then build your webpart and deploy it to appcatalog. – Diksha Poddar Sep 13 at 10:20
0

When you deploy the package, please check if it gets content from localhost:

enter image description here

Please have a try below commands to fix it:

gulp clean
gulp build
gulp bundle --ship
gulp package-solution --ship

And i suggest you enable Office 365 CDN and host the webpart on CDN:

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.