mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
334b46e8d9
* Add analyze-bundles example * housekeeping: with-webpack-bundle-analyzer example * analyze-bundles example: revert the version of faker library * analyze-bundles add analyze:server and analyze:browser to scripts * with-webpack-bundle-analyzer example: fix typo
51 lines
1.2 KiB
Markdown
51 lines
1.2 KiB
Markdown
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/analyze-bundles)
|
|
|
|
# Analyzer Bundles example
|
|
|
|
## How to use
|
|
|
|
### Using `create-next-app`
|
|
|
|
Execute [`create-next-app`](https://github.com/segmentio/create-next-app) with [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) or [npx](https://github.com/zkat/npx#readme) to bootstrap the example:
|
|
|
|
```bash
|
|
npx create-next-app --example analyze-bundles analyze-bundles-app
|
|
# or
|
|
yarn create next-app --example analyze-bundles analyze-bundles-app
|
|
```
|
|
|
|
### Download manually
|
|
|
|
Download the example:
|
|
|
|
```bash
|
|
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/analyze-bundles
|
|
cd analyze-bundles
|
|
```
|
|
|
|
Install it
|
|
|
|
```bash
|
|
npm install
|
|
npm run dev
|
|
# or
|
|
yarn
|
|
yarn dev
|
|
```
|
|
|
|
## The idea behind the example
|
|
|
|
This example shows how to analyze the output bundles using [@zeit/next-bundle-analyzer](https://github.com/zeit/next-plugins/tree/master/packages/next-bundle-analyzer)
|
|
|
|
To analyze your webpack output, invoke the following command:
|
|
|
|
```bash
|
|
npm run analyze
|
|
npm run analyze:server
|
|
npm run analyze:browser
|
|
# or
|
|
yarn analyze
|
|
yarn analyze:server
|
|
yarn analyze:browser
|
|
```
|