If you've been building WebResources for Dataverse using React, TypeScript, and Fluent UI, you've probably already stumbled upon my previous posts on this topic, and probably right now you rely on @_neronotte/cra-template-dataverse-webresources
and @_neronotte/cra-template-dataverse-webresources-forms
, my scaffolding templates for Create React App (CRA).
Well, times are changing: CRA has officially been deprecated! ๐ฑ
If you try to start creating a new react app with CRA, since Feb 14th the installer shows you the following deprecation warning:
But don't worryโIโve got you covered. After some serious hands-on work, Iโve migrated my templates to Vite, the community-suggested replacement for CRA. Say hello to vite-template-dataverse-webresources
! ๐
๐ GitHub Repo: https://github.com/neronotte/vite-template-dataverse-webresources
Why Vite? โก
Vite is faster, leaner, and just better than CRA in so many ways:
- Instant server startup โฉ
- Faster hot module replacement ๐ฅ
- Optimized build process ๐๏ธ
- Native ESM support ๐ฆ
If you're still on CRA, nowโs the perfect time to migrate!
Whatโs in the Box? ๐ฆ
The repository now contains two branches:
- ๐ Main Branch (for Sitemap & Modal WebResources)
- Use this template to create WebResources that are accessed from the Dataverse sitemap, or open as modal dialog or side panes in model-driven apps.
- ๐ Forms Branch (for WebResources inside Forms)
- Use this template to create WebResources that integrate directly into Dataverse forms, and need to interact with form data and context
How to Get Started ๐
Getting up and running is easier than ever. You can use degit
to clone the repo templates. If you don't have it already installed, you can do it via:
npm install -g degit
then just type:
npx degit neronotte/vite-template-dataverse-webresources#main my-webresource
cd my-webresource
npm install
(replace #main
with #forms
if you want to use the template for form-based WebResources)
And follow the instructions on the README.md
file to have everything properly set-up and ready to use. ๐ฅ
To run your WebResource and debug it locally you can simply type:
npm run dev
It will launch Vite local server, tipically on port 5173. You can just open a browser on http://localhost:5173 and you're ready to go!
To build your WebResource in production mode, ready to be deployed in your Dataverse, just type:
npm run build
Then you can use PACX as described here to upload the generated HTML/JS/CSS files into Dataverse.
Migration Made Easy ๐ฏ
If you've been using CRA for your Dataverse WebResources, moving to Vite is effortless with this template. The structure remains familiar, and the setup process is straightforwardโso you can transition smoothly without hassle.
Check out the repo, give it a try, and let me know if you have any feedback! Contributions are always welcome. ๐๐ก
Happy coding! ๐
Top comments (0)