Time: 5 minutes
We're going to start our application in Angular CLI's "production" mode to make our application as lightweight and fast as possible for performance analysis.
With the application running, we'll use Lighthouse to analyze the performance of the application. The Lighthouse tool is built into Google Chrome's developer tools.
- Start the server by running
npm run server
. - Let's create a new npm script to serve the application in prod mode. Open
package.json
and add the following to thescripts
object:"customer-portal:prod": "ng serve --prod --proxy-config=proxy.config.json -a=customer-portal -p=4203"
- In a new terminal window, start the customer portal in production mode by running
npm run customer-portal:prod
. - Open Google Chrome and navigate to localhost:4203.
- Open Chrome Devtools:
- Mac:
Cmd + Opt + I
- Windows:
F12
- Mac:
- Click the "Audits" tab then click the "Perform an Audit" button.
- In the audit modal, uncheck all audits except "Performance".
- Click "Run Audit" and watch Lighthouse work its magic. You should see Lighthouse reload the page in an emulated mobile device, with emulated 3G network and emulated mobile CPU performance.
- After the audit is finished, you should see a report with several scores. Record the scores for First Meaningful Paint and First Interactive so we can compare them after we've made some optimizations. Also notice the screenshots of progression as the app is loaded.
What interesting information can be found from other audits?
What opportunities or recommendations does Lighthouse provide?
Go to Optimizing Performance Lab #2: Source Map Explorer