Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

Share node_modules between PCF projects

(0) ShareShare
ReportReport
Posted on by

Hi all. I am new to code component development for PowerApps and found that for every project created using pac pcf init, a folder of Node modules are installed. The node_modules folder is 160+ MB in size too. Therefore, I want to share the modules between 2 projects to reduce the size of each project folder and streamline the development process.

 

I tried the following directory structure while removing the node_modules and duplicated files from each project folder:

Root
/Project_1
/Project_2
/node_modules
/package.json
/package-lock.json
/pcfconfig.json
/tsconfig.json

When executing npm start watch from Project_1 directory, the components from both Project_1 and Project_2 are compiled together and only the first compiled component is launched in the local server.

 

Is it possible for multiple PCF projects to share a node_modules folder? If so, is there a way to only run a selected component?

 

Hope to hear from the community and the pros. Thank you in advance.

  • mpilarczyk Profile Picture
    44 on at
    Re: Share node_modules between PCF projects

    Hi @marchello did you have any issues with Solution packaging and running start scripts when using monorepo approach?
    I was trying to achieve the same with npm workspaces but it's failing due to missing packages that msbuild expects to have within folder where the pcf component is defined. Was wondering if you had to adjust anything in .pcfproj file? Or is it pnpm that does things differently so you didn't face that issue?

  • Community Power Platform Member Profile Picture
    on at
    Re: Share node_modules between PCF projects

    Hi @marchello. Thank you very much for your suggestion. I read up about monorepo and pnpm, and I have implemented them in my workspace with Nx as my monorepo support.

  • Verified answer
    marchello Profile Picture
    28 on at
    Re: Share node_modules between PCF projects

    Hi,

     

    What I did was, I created a monorepo with pnpm. This way the node_modules are not duplicated and I can also share components between my PCF projects. You can launch and build the projects separately as you wish.

     

    I also added Turborepo on top of everthing else, so when I build my PCF Solution only the modified projects are built, the rest are cached, so the build times are much shorter.

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 87 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 71 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 67 Super User 2025 Season 1

Overall leaderboard