Wednesday, August 30, 2017

How to update a SharePoint Framework project to Drop 1.2 (Extensions RC0)

[Update September 2nd, 2017]

I’ve updated the steps to remove the node_modules forlder, as that seems to fix some of the build libraries.

--

With the release of SharePoint Framework Extensions RC, SPFx has moved to Drop 1.2. If you want to update an existing project these are the steps you need to take.

Update the generator to Drop 1.2

npm install -g @microsoft/generator-sharepoint 

Enter your SPFx project folder and open package.json, where you need to update the version numbers for the following packages:

dependencies

"@microsoft/sp-core-library": "~1.2.0",
"@microsoft/sp-webpart-base": "~1.2.0",
"@types/react": "15.0.38",


devDependencies

"@microsoft/sp-build-web": "~1.2.0",
"@microsoft/sp-module-interfaces": "~1.2.0",
"@microsoft/sp-webpart-workbench": "~1.2.0"

If you have other @microsoft packages, set them to 1.2 as well, or if it’s @microsoft/sp-client-base, you can remove it.

Next up, remove your node_modules folder with your favorite command before running:

npm install
gulp --upgrade

And you should be all set!

NOTE! You may run into other breaking API changes you have to deal with.

NOTE 2! If you are using Office UI Fabric with react, Drop 1.2 takes a dependency on v4.32.0, and not on v2.34.2. If you have an explicit link to v2.x, then you have to upgrade in order for the build to work. See this issue for information about Office UI Fabric React which I raised with Drop 1.2 https://github.com/SharePoint/sp-dev-docs/issues/827

8 comments:

  1. Thanks for this reference! I also had to run gulp --upgrade to update my config.json file.

    ReplyDelete
    Replies
    1. Thanks! And sorry, one more...I also had to update in the dependencies for my application customizer extension:
      "@microsoft/sp-application-base": "1.2.0"

      Delete
  2. Run npm install -g @microsoft/generator-sharepoint as admin was required for me :)

    ReplyDelete
    Replies
    1. For me as well, but not everyone run Windows, so I omitted that on purpose :)

      -g on Windows always require admin permissions, and ppl probably know if they have installed SPFx in the first place.

      Delete
  3. "Next up, remove your node_modules folder with your favorite command before running:", what? can the command be: right click > delete

    ReplyDelete