Skip to content

Library components are not working #4613

@StfBauer

Description

@StfBauer

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.

Screenshot 2019-09-11 at 13 57 14

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.

Screenshot 2019-09-11 at 13 57 14

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.

Screenshot 2019-09-11 at 15 14 21

This screenshot shows the result of the compiled web part.

Steps to Reproduce

Source code used to reproduce can be found here..

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackAwaiting response from the original poster of the issue. Marked as stale if no activity for 7 days.Needs: Triage 🔍Awaiting categorization and initial review.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions