Add custom client web part SharePoint framework into your modern page

Доброго времени суток.

Если вы столкнулись с проблемой добавления вашей собственной клиентской веб части на страницу публикации в новой стилистике (Modern Page) и при добавлении веб части у вас ошибка "There was an error fetching the web parts> Not all web parts may be available"

screen-shot-2016-11-21-at-10-20-17-pm

Чтобы убрать эту ошибку вам необходимо для начала обновить ваш проект, установив обновления SharePoint Framework.

https://github.com/SharePoint/sp-dev-docs/wiki/Release-Notes-Drop-5

Самое важное, на что необходимо обратить внимание

In order to move to the newer implementation, you need to do a few things.

  • 1 - Add the package via npm i --save @microsoft/sp-webpart-base . This should update the dependencies section of your package.json file to reference "@microsoft/sp-webpart-base":"~0.1.0".
  • 2 - Update the config.json file in the config folder to add it to the externals section under sp-client-preview "@microsoft/sp-webpart-base": "node_modules/@microsoft/sp-webpart-base/dist/sp-webpart-base.js",
  • 3 - Update your webpart source code to move the import references from @microsoft/sp-client-preview to @microsoft/sp-webpart-base

То есть после того, как вы выполните обновление, вам необходимо обновить референсы в вашей ваб части с sp-client-preview на sp-webpart-base.

Далее создаете новый пакет и обновляете решение.

screen-shot-2016-11-21-at-10-07-19-pm