Skip to main content

Notifications

Community site session details

Community site session details

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

PCF Harness (NPM Start), how do i target another control to start?

(0) ShareShare
ReportReport
Posted on by

Might be a silly question, but i'm working on two controls at the moment.

 

How do i set the target of the "npm start" harness to load the second control?

 

:\PCF_Controls\_PCF\NumberButtonSelector>npm start

> pcf-project@1.0.0 start C:\PCF_Controls\_PCF
> pcf-scripts start

Kicking off PCF start process...
.....
Starting control harness...
Mapping / to "C:\PCF_Controls\_PCF\node_modules\pcf-start"
Serving "C:\PCF_Controls\_PCF\out\controls\Control1" at http://127.0.0.1:8181 ***I WANT IT TO LOAD Control2, not 1****
Ready for changes
  • leiff Profile Picture
    3 on at
    Re: PCF Harness (NPM Start), how do i target another control to start?

    I was having the same issue, and I wanted to be able to use the 'watch' option and without needing to build to 'out' to quickly see my changes.

    I turns out, that the test harness simply runs the first control - sorted alphabetically on the containing folders.

    So you can simply prefix the foldername containing the control that you want to execute with an underscore, and then run 'npm run watch'

     

    /Leif

  • Community Power Platform Member Profile Picture
    on at
    Re: PCF Harness (NPM Start), how do i target another control to start?
     That script is designed to accept a --codePath argument which enables a user to point the harness to any directory that contains compiled control sources (ControlManifest.xml and bundle.js).

    ^ that's perfect.  Thank you alchin.

  • Verified answer
    alchin Profile Picture
    Microsoft Employee on at
    Re: PCF Harness (NPM Start), how do i target another control to start?

    Hi Andrew,

     

    By default NPM start is designed to initiate the control defined in the current PCF project into the harness.  If you have two separate control projects (PCF project), then you will need to CD into the root of the second pcf project and run npm start.  All of the npm commands are project centric commands (build, clean, rebuild, start) and are designed to be applied to the current project only.

     

    Under the hood, npm start calls the pcf-start script.  That script is designed to accept a --codePath argument which enables a user to point the harness to any directory that contains compiled control sources (ControlManifest.xml and bundle.js).

     

    For example, if I had my control code compiled into a folder called c:\out\controls\mycontrol, I could run:

    npx pcf-start --codePath c:\out\controls\mycontrol

     

    to launch the control from any output folder.

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

🌸 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…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 81 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 53 Super User 2025 Season 1

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 46 Super User 2025 Season 1

Overall leaderboard