knowledgecenter-breadcrum

Knowledge Center

02 Jul, 2022

PCF Tips & Tricks: Tips to minimize the size of your PCF components.

Posted on 02 Jul, 2022 by Admin, Posted in Dynamics 365 PCF (PowerApps Component Framework) Power Platform

PCF Tips & Tricks: Tips to minimize the size of your PCF components. Blogs

PCF Tips & Tricks: Tips to minimize the size of your PCF components.

Introduction

Recently we were working on a PCF control using Fluent UI, everything was fine at the development stage, but when we tried to import it into CRM it says its too heavy.

 

Solution

Tip 1 – Use only what is required.

You have to take care of few things while you are importing FluentUI controls in your index.ts of PCF control.

You should be importing the controls in granular fashion – ie. import only needed controls. Otherwise bundle.js size will be huge. Import the necessary controls using @fluentui/react/lib/… rather than the whole @fluentui/react.

File size when importing the whole using @fluentui/react.

File size when importing the necessary controls using @fluentui/react/lib/.

Tip 2 – use production mode

We can build a component in ‘production(i.e. minified)’ mode just using a single line of code.

When the control is ready and you want to push it to the CDS environment open *.pcfproj file and look for the following part of the file:

Add the line production to turn it to:

Save the file and use pac pcf push command to import your component to CDS. So here is what happened to the size of bundle.js:

Comment

This is a Required Field

Loading

Recent Updates

Thumbnail D365 Sales
Blogs
09 Apr, 2025

What Is Dynamics 365 Sales? A Comprehensive Guide

What Is Dynamics 365 Sales? A Comprehensive Guide Microsoft has become a leader in business applications with its suite of…

READ MORE
Blogs
02 Apr, 2025

Quality is not just an option; it’s a responsibility

In the world of software development, testing is often seen as an optional phase, especially when there is no dedicated…

READ MORE
Thumbnail
Blogs
26 Mar, 2025

What is Power Virtual Agents: Exploring AI-Driven Virtual Chatbots?

What is Power Virtual Agents: Exploring AI-Driven Virtual Chatbots? In today’s digital landscape, businesses are constantly seeking ways to enhance…

READ MORE