Skip to content

SPFx 1.9.1: Entry point of library component bundle is not /lib/index.js anymore #4570

@vman

Description

@vman

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

For an SPFx library component bundle, the entry point in the config/config.json should be the /lib/index.js file:

"bundles": {
    "my-custom-library": {
      "components": [
        {
          "entrypoint": "./lib/index.js",
          "manifest": "./src/CustomOfficeUiFabricLibrary.manifest.json"
        }
      ]
    }
  },

Observed Behavior

In 1.8.2-plusbeta if a library component was created, the config/config.json had the bundle defined as:

"bundles": {
    "my-custom-library": {
      "components": [
        {
          "entrypoint": "./lib/index.js",
          "manifest": "./src/CustomOfficeUiFabricLibrary.manifest.json"
        }
      ]
    }
  },

Since 1.9.1 the bundle entrypoint is now the default exported class:

"bundles": {
    "my-custom-library": {
      "components": [
        {
          "entrypoint": "./lib/libraries/customOfficeUiFabric/CustomOfficeUiFabricLibrary.js",
          "manifest": "./src/libraries/customOfficeUiFabric/CustomOfficeUiFabricLibrary.manifest.json"
        }
      ]
    }
  },

So if we add any more components to the library like this:

image

and then add the export to the index.ts file:

export { ButtonComponent } from './customFabric/ButtonComponent';

The components does not get included in the final bundle because the bundle entry point is pointing to the default class.

Steps to Reproduce

Create a library component project with SPFx generator version 1.9.1 and observe the config/config.json file

Thanks for your contribution! Sharing is caring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:spfxCategory: SharePoint Framework (not extensions related)status:to-be-reviewedIssue needs to be reviewed by Microsoft for additional follow up / review.type:questionQuestion... if answered, will be tagged as such.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions