sp-dev-docs icon indicating copy to clipboard operation
sp-dev-docs copied to clipboard

Failed to load component on premises

Open hugoabernier opened this issue 8 years ago • 7 comments

Category

  • [ ] Question
  • [ ] Typo
  • [x] Bug
  • [ ] Additional article idea

Expected or Desired Behavior

A a new SPFx web part created using Yeoman should be deployable to SharePoint 2016 on Premises and run without issues.

Observed Behavior

SPFx web part returns:

**ERROR MESSAGE: **Failed to load component "cba5a782-4e93-4336-a265-6480620eae92" (HelloWorldWebPart). Original error: ***Failed to load entry point from component "cba5a782-4e93-4336-a265-6480620eae92" (HelloWorldWebPart). Original error: Error loading https://component-id.invalid/cba5a782-4e93-4336-a265-6480620eae92_0.0.1 https://component-id.invalid/cba5a782-4e93-4336-a265-6480620eae92_0.0.1 did not call System.register or AMD define. If loading a global module configure the global name via the meta exports property for script injection support. ***CALLSTACK: Error: ***Failed to load component "cba5a782-4e93-4336-a265-6480620eae92" (HelloWorldWebPart). Original error: ***Failed to load entry point from component "cba5a782-4e93-4336-a265-6480620eae92" (HelloWorldWebPart). Original error: Error loading https://component-id.invalid/cba5a782-4e93-4336-a265-6480620eae92_0.0.1 https://component-id.invalid/cba5a782-4e93-4336-a265-6480620eae92_0.0.1 did not call System.register or AMD define. If loading a global module configure the global name via the meta exports property for script injection support. at Anonymous function (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:507:105789) at q (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:8:2379) at B (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:8:2467) at k (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:8:2289) at L (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:8:1885) at y (http://contoso/_layouts/15/next/spfx/sp-classic-page-assembly_en-us.js?version=1:8:570)

Steps to Reproduce

  1. Launch Yeoman generator using yo (at)microsoft/sharepoint
  2. When prompted for a baseline package, select SharePoint 2016 onwards, including SharePoint Online
  3. Accept all other defaults. The issue happens with any framework.
  4. Once Yeoman complete, test web part on workbench using gulp serve. The web part should work successfully.
  5. Create a CDN location for your package assets.
  6. Add the path to your CDN by updating the cdnBasePath property in config/write-manifest.json
  7. Build package for deployment using gulp bundle --ship and gulp package-solution --ship
  8. Upload content of the dist folder to your CDN library
  9. Upload the .sppkg file found in the sharepoint/solution folder to your on-premises app catalog
  10. Add web part to a test site.

I sincerely hope that it is something I did wrong, but I've eliminated every steps where I could have introduced an issue and i still get a bug.

hugoabernier avatar May 08 '18 17:05 hugoabernier

I ran network profiling in Chrome's developer tools and found that the browser is looking for hello-world-web-part_74e94df2a446590a826da7237beeba04.js, but the dist folder only contains hello-world-web-part.js. Renaming the file to match what the browser is looking for fixed the issue. It must be something in the bundling or solution packaging.

I hope this helps?

hugoabernier avatar May 08 '18 17:05 hugoabernier

The hash in file name can be enabled/disabled from the below line in gulpfile.js. build.copyAssets.taskConfig = { excludeHashFromFileNames: true };

emadaliny avatar May 09 '18 22:05 emadaliny

Yes, but why would a brand new, out of the (yeoman) big web part not work?

hbgeorgian avatar May 09 '18 22:05 hbgeorgian

Hi @hugoabernier - can you double check the version of the SP2016 you are using and that the Feature Pack 2 is required for that to be able to support SPFx. Thx.

VesaJuvonen avatar May 10 '18 18:05 VesaJuvonen

@VesaJuvonen We're at version 16.0.4690.1000, which includes FP2 -- correct

hugoabernier avatar May 10 '18 18:05 hugoabernier

This is a standard scenario that we have tested creating an out of the box webpart. The error does not repro for us. Due to the nature of it being an on premises solution you will need to engage support to follow up on the issue.

GrahamMcMynn avatar Jul 24 '18 17:07 GrahamMcMynn

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

msft-github-bot avatar Jan 27 '20 18:01 msft-github-bot