Skip to content

Commit f34ab68

Browse files
russgoveVesaJuvonen
authored andcommitted
Update debug-modern-pages.md (SharePoint#1720)
* Update debug-modern-pages.md documented debugging webparts by comiling without the --ship parameter * Update debug-modern-pages.md
1 parent 88eb153 commit f34ab68

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/spfx/debug-modern-pages.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,28 @@ SharePoint Framework workbench conveniently mimics the canvas of modern SharePoi
177177

178178
Using the SharePoint workbench, you can only test web parts from your solution. But what if you wanted to see how your web part works with other web parts on the page? Testing your local solution on modern pages using the approach outlined in this article, is way more efficient than packaging your project, deploying it to the app catalog and adding the web part to the page.
179179

180+
## Debug SharePoint Framework web parts -- an alternative approach
181+
182+
If you build your spfx webpart solution without the --ship parameter as following
183+
184+
```sh
185+
gulp bundle
186+
gulp package-solution
187+
```
188+
189+
the packages generated will reference the code from your local computer (https://localhost:4321). You can deploy the solution to the app catalog as you normally would.
190+
191+
You can then start your local server by running
192+
193+
```sh
194+
gulp serve --nobrowser
195+
```
196+
197+
Now you can go back to a SharePoint site where the solution has been deployed and add the webparts to any page -- modern or classic-- and the webpart code will be loaded from your local development environment. You can debug your webparts just as you would if you ran 'gulp serve' and added your webpart to the workbench.
198+
199+
This approach should only be used when you are in development mode. If you deploy an app to the app catalog that points to your local host, it will fail to run if your development environment is not running.
200+
201+
180202
## See also
181203

182204
- [Debug SharePoint Framework solutions in Visual Studio Code](debug-in-vscode.md)

0 commit comments

Comments
 (0)