π§ The Paradigm Shift: Why We Donβt Argue UI Anymore
There was a time (you remember it) when any client request that drifted outside the "blessed" Power Apps patterns triggered a long conversation about platform constraints. We tried to reshape requirements, push standard controls, and hope stakeholders would accept a slightly clunky interaction with the UI in the name of long-term maintainability.
That era is over.
With AI-assisted development (hello my dear friend, GitHub Copilot), itβs now faster and safer to build small, targeted customizationsβPCFs or React WebResourcesβthan to litigate UX.
You can ship exactly what the client envisions, document it properly, and make it maintainable long-term. The payoff is huge: better UX β higher adoption β stronger platform stickiness. In other words, great UI is not a "nice-to-have"βitβs a retention strategy.
When you replace βdiscuss why we canβtβ with βdeliver what delights,β you:
- Earn trust faster
- Accelerate sign-off
- Anchor the customer to the platform with experiences they love
But thereβs a catchβ¦
π§± The Problem: A Dozen PCFs/WebResources = Disk Space Meltdown
React-based PCFs and WebResources lean on Nodeβs ecosystem. And Nodeβs ecosystem leans onβ¦ node_modulesβthe folder that eats hard drives for breakfast.
Every project carries its own dependency tree. Multiply that across 8, 12, 20 PCFs/WebResourcesβ¦ and your laptop screams. Itβs common to see hundreds of thousands of files and tens (or hundreds) of GB consumed across projects.
Good news: thereβs a clean, robust solution that many Power Platform devs underuse:
π§© The Hidden Gem: NPM Workspaces
NPM Workspaces let you manage multiple packages/projects (PCFs/WebResources) under one repository, sharing a single top-level node_modules whenever possible. This dramatically reduces duplication and makes dependency management more predictable and CI-friendly.
What you get:
- β
One central
node_modules(plus small per-package shims when needed) - β Shared tooling (TypeScript config, lint rules, build scripts)
- β Shared local packages (@types/xrm, @fluentui/react-components) used across PCFs/WRs via workspace:
- β Unified scripts (build, test, lint) across all packages
- β Faster CI with a single dependency tree and cache
π€ How Does It Works?
It's quite straightforward. All you need is to define a package.json and a package-lock.json files at the root of your project folder, just above the folders containing PCFs and WebResources. This will make your project folder a monorepo.
π my-monorepo/
ββ π package.json <-- workspace root
ββ π package-lock.json
β
ββ π Pcf/
β ββ π pcf1/
β β ββ π package.json
β β ββ ...
β ββ π pcf2/
β ββ π package.json
β ββ ...
β
ββ π WebResources/
ββ π webresource1/
β ββ π package.json
β ββ ...
ββ π webresource2/
ββ π package.json
ββ ...
It is important that the root package.json file contains the following:
{
"name": "my-monorepo",
"private": true,
"workspaces": [
"Pcf/*",
"WebResources/*",
]
}
You can do it manually, or via:
cd my-monorepo
npm init -y
npm pkg set private=true
npm pkg set workspaces[0]="Pcf/*"
npm pkg set workspaces[1]="WebResources/*"
Then you can create your PCFs into the PCF and WebResources folder as usual... Just a tip: remember that the value of the name node of the package.json files under each of your PCFs/WRs must be unique, otherwise you'll get an error while running npm <whatever>.
When you'll run
npm install
All dependencies will be installed in a single, above all, node_modules folder created just under the my-monorepo folder.
NOTE: If two packages need different versions of the same dep, npm may place some deps locally. Thatβs fine; youβll still save tons of space overall.
ποΈ A Practical Folder Structure for Power Platform Projects
Hereβs a realistic example of the output folder you'll get, on a standard Power App project:
π project-folder
ββ π .gitignore
ββ π src
β ββ π package.json
β ββ π package-lock.json
β ββ π node_modules
β ββ π Pcf
β β ββ π NumericInputControl
β β β ββ π package.json
β β β ββ π package-lock.json
β β β ββ ...
β β ββ π PurchaseOrderGrid
β β β ββ π package.json
β β β ββ π package-lock.json
β β β ββ ...
β β ββ π CustomTreeView
β β ββ π package.json
β β ββ π package-lock.json
β β ββ ...
β ββ π WebResources
β ββ π HomePage
β β ββ π package.json
β β ββ π package-lock.json
β β ββ ...
β ββ π ControlDashboard
β ββ π package.json
β ββ π package-lock.json
β ββ ...
ββ π test
ββ ... # other stuff
π How Much Space Do You Actually Save?
In Power Platform solutions with 8β20 React packages, weβve seen:
- 60β80% reduction in duplicated dependency files
- Build times drop (less overall I/O and fewer cold installs)
Your mileage varies with library choices, but the direction is always the same: less bloat, more flow.
πͺ Conclusions
AI copilot tools make building custom, crisp UX easy. NPM Workspaces make maintaining many customizations sane. Put them together and youβve got a Power Platform development lifecycle thatβs fast, clean, andβdare I sayβfun.
Give it a try, and let me know in the comments what you think about it!
Top comments (0)