BenRunInBay / vue3-spfx

Sample Vue 3 app built using Vite that is embedded within an SPFX 1.12 webpart
21 stars 8 forks source link

Update to SPFx 1.16.1, Node v16, Typescript v5, Vite v4, and PnP/SP v3. #11

Open Zugidor opened 1 year ago

Zugidor commented 1 year ago

Includes @LOLCATATONIA's PR #8.
Kept sample as similar/faithful as possible, changing only what was necessary for the new SPFx, Vite, and PnP versions.
Credit for getting Vite 4 working to @spevilgenius. This should build with no errors as is.

Reasoning: It's nice to keep this up-to-date for anyone who may find it useful like I have. The update included non-negligible changes and troubleshooting.

spevilgenius commented 5 months ago

A year later and though this still works, there are some new thoughts on this for me. Mainly, this will only seem to work in the options API mode of Vue. The "webpartproperties" functions to pass properties still add them to the instance properly. The issue is that you can't use "this" in the "script setup" option of the composition API so you lose access to "this.$root" The only option I can think of here is to use an outer wrapper component to perform this piece but pass the data to a new composition API component.