-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Category
- Question
- Typo
- Bug
- Additional article idea
Related issue #4507 but more in-depth analysis.
Expected or Desired Behavior
It seems like that library components or documentation is missing following the instructions do not lead to a library component.
Observed Behavior
Following the instruction 1:1 on how to create a library component Leaded to the following result.
It doesn't make any difference if the library component is deployed to the server or not.
The following statement should be rendered by the library component that, at this time wasn't installed on the tenant.
The current time as returned from the corporate library is 13:22:54 GMT+0200 (Central European Summer Time)
The web part potentially should have raised an error. This behaviour is caused due by the following in code snippet:
import * as myLibrary from 'corporate-library';This treats the 'corporate-library' as a regular NPM package and compiles directly the code in the final web part code. Instead of loading it from a library component.
This might could have been used as a fallback mechanism but even after installing the library component, with a changed return value of the library.
export class CorporateLibraryLibrary {
public getCurrentTime(): string {
return 'Hello World: time as returned from the corporate library is ' + new Date().toTimeString();
}
}The result of the web part looked exactly the same.
The result was that the library component wasn't picked up at all.
To verify that the source code of the library component was embedded in the code. The actually library component showed up directly in.
This screenshot shows the result of the compiled web part.
Steps to Reproduce
Source code used to reproduce can be found here..


