From 7237cc927fe26097732451fe91e8fb4967279095 Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 11 Aug 2023 08:16:54 +0200 Subject: [PATCH 1/3] docs: viteconf 23 link (#14075) --- .vitepress/theme/components/AsideSponsors.vue | 63 +++++++++++++++++++ index.md | 3 + public/viteconf.svg | 25 +++++++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/.vitepress/theme/components/AsideSponsors.vue b/.vitepress/theme/components/AsideSponsors.vue index 90e6adda..dcaf4492 100644 --- a/.vitepress/theme/components/AsideSponsors.vue +++ b/.vitepress/theme/components/AsideSponsors.vue @@ -18,5 +18,68 @@ const sponsors = computed(() => { + + diff --git a/index.md b/index.md index bdf716bc..07d3c0a0 100644 --- a/index.md +++ b/index.md @@ -21,6 +21,9 @@ hero: - theme: alt text: View on GitHub link: https://github.com/vitejs/vite + - theme: brand + text: ViteConf 23! + link: https://viteconf.org/23 features: - icon: 💡 diff --git a/public/viteconf.svg b/public/viteconf.svg index a01c0bd2..2ca20c23 100644 --- a/public/viteconf.svg +++ b/public/viteconf.svg @@ -1 +1,24 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + From f78f5e3ead9759a8428094c876b9adbd74374eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Fri, 11 Aug 2023 17:40:33 +0200 Subject: [PATCH 2/3] docs(cli): include `--profile` option (#14079) --- guide/cli.md | 38 ++++++++++++++++++++------------------ guide/troubleshooting.md | 22 ++++++++++++++++++++++ 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/guide/cli.md b/guide/cli.md index 05061070..497ad661 100644 --- a/guide/cli.md +++ b/guide/cli.md @@ -14,24 +14,25 @@ vite [root] #### Options -| Options | | -| ------------------------ | ----------------------------------------------------------------- | -| `--host [host]` | Specify hostname (`string`) | -| `--port ` | Specify port (`number`) | -| `--https` | Use TLS + HTTP/2 (`boolean`) | -| `--open [path]` | Open browser on startup (`boolean \| string`) | -| `--cors` | Enable CORS (`boolean`) | -| `--strictPort` | Exit if specified port is already in use (`boolean`) | -| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | -| `-c, --config ` | Use specified config file (`string`) | -| `--base ` | Public base path (default: `/`) (`string`) | -| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | -| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | -| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | -| `-f, --filter ` | Filter debug logs (`string`) | -| `-m, --mode ` | Set env mode (`string`) | -| `-h, --help` | Display available CLI options | -| `-v, --version` | Display version number | +| Options | | +| ------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `--host [host]` | Specify hostname (`string`) | +| `--port ` | Specify port (`number`) | +| `--https` | Use TLS + HTTP/2 (`boolean`) | +| `--open [path]` | Open browser on startup (`boolean \| string`) | +| `--cors` | Enable CORS (`boolean`) | +| `--strictPort` | Exit if specified port is already in use (`boolean`) | +| `--force` | Force the optimizer to ignore the cache and re-bundle (`boolean`) | +| `-c, --config ` | Use specified config file (`string`) | +| `--base ` | Public base path (default: `/`) (`string`) | +| `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | +| `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | +| `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | +| `-f, --filter ` | Filter debug logs (`string`) | +| `-m, --mode ` | Set env mode (`string`) | +| `-h, --help` | Display available CLI options | +| `-v, --version` | Display version number | ## Build @@ -65,6 +66,7 @@ vite build [root] | `--base ` | Public base path (default: `/`) (`string`) | | `-l, --logLevel ` | Info \| warn \| error \| silent (`string`) | | `--clearScreen` | Allow/disable clear screen when logging (`boolean`) | +| `--profile` | Start built-in Node.js inspector (check [Performance bottlenecks](/guide/troubleshooting#performance-bottlenecks)) | | `-d, --debug [feat]` | Show debug logs (`string \| boolean`) | | `-f, --filter ` | Filter debug logs (`string`) | | `-m, --mode ` | Set env mode (`string`) | diff --git a/guide/troubleshooting.md b/guide/troubleshooting.md index 41089024..75af887e 100644 --- a/guide/troubleshooting.md +++ b/guide/troubleshooting.md @@ -144,6 +144,28 @@ You will need to access the file with `http` protocol. The easiest way to achiev The hash key used to invalidate optimized dependencies depend on the package lock contents, the patches applied to dependencies, and the options in the Vite config file that affects the bundling of node modules. This means that Vite will detect when a dependency is overridden using a feature as [npm overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides), and re-bundle your dependencies on the next server start. Vite won't invalidate the dependencies when you use a feature like [npm link](https://docs.npmjs.com/cli/v9/commands/npm-link). In case you link or unlink a dependency, you'll need to force re-optimization on the next server start by using `vite --force`. We recommend using overrides instead, which are supported now by every package manager (see also [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides) and [yarn resolutions](https://yarnpkg.com/configuration/manifest/#resolutions)). +## Performance bottlenecks + +If you suffer any application performance bottlenecks resulting in slow load times, you can start the built-in Node.js inspector with your Vite dev server or when building your application to create the CPU profile: + +::: code-group + +```bash [dev server] +vite --profile --open +``` + +```bash [build] +vite build --profile +``` + +::: + +::: tip Vite Dev Server +Once your application is opened in the browser, just await finish loading it and then go back to the terminal and press `p` key (will stop the Node.js inspector) then press `q` key to stop the dev server. +::: + +Node.js inspector will generate `vite-profile-0.cpuprofile` in the root folder, go to https://www.speedscope.app/, and upload the CPU profile using the `BROWSE` button to inspect the result. + ## Others ### Module externalized for browser compatibility From d508009a71058d02563d45e4e519f44453d414c0 Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 11 Aug 2023 20:53:26 +0200 Subject: [PATCH 3/3] docs: icon in ViteConf action --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 07d3c0a0..fb683307 100644 --- a/index.md +++ b/index.md @@ -22,7 +22,7 @@ hero: text: View on GitHub link: https://github.com/vitejs/vite - theme: brand - text: ViteConf 23! + text: 🎉 ViteConf 23! link: https://viteconf.org/23 features: