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/guide/cli.md b/guide/cli.md index e629dc77..129348d0 100644 --- a/guide/cli.md +++ b/guide/cli.md @@ -14,6 +14,7 @@ vite [root] #### 选项 {#options} +<<<<<<< HEAD | 选项 | | | ------------------------ | ------------------------------------------- | | `--host [host]` | 指定主机名称 (`string`) | @@ -32,6 +33,27 @@ vite [root] | `-m, --mode ` | 设置环境模式 (`string`) | | `-h, --help` | 显示可用的 CLI 选项 | | `-v, --version` | 显示版本号 | +======= +| 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 | +>>>>>>> d508009a71058d02563d45e4e519f44453d414c0 ## 构建 {#build} @@ -47,6 +69,7 @@ vite build [root] #### 选项 {#options-1} +<<<<<<< HEAD | 选项 | | | ------------------------------ | -------------------------------------------------------------------------------------------- | | `--target ` | 编译目标(默认为:`"modules"`)(`string`) | @@ -69,6 +92,31 @@ vite build [root] | `-f, --filter ` | 过滤调试日志 (`string`) | | `-m, --mode ` | 设置环境模式 (`string`) | | `-h, --help` | 显示可用的 CLI 选项 | +======= +| Options | | +| ------------------------------ | ------------------------------------------------------------------------------------------------------------------- | +| `--target ` | Transpile target (default: `"modules"`) (`string`) | +| `--outDir ` | Output directory (default: `dist`) (`string`) | +| `--assetsDir ` | Directory under outDir to place assets in (default: `"assets"`) (`string`) | +| `--assetsInlineLimit ` | Static asset base64 inline threshold in bytes (default: `4096`) (`number`) | +| `--ssr [entry]` | Build specified entry for server-side rendering (`string`) | +| `--sourcemap [output]` | Output source maps for build (default: `false`) (`boolean \| "inline" \| "hidden"`) | +| `--minify [minifier]` | Enable/disable minification, or specify minifier to use (default: `"esbuild"`) (`boolean \| "terser" \| "esbuild"`) | +| `--manifest [name]` | Emit build manifest json (`boolean \| string`) | +| `--ssrManifest [name]` | Emit ssr manifest json (`boolean \| string`) | +| `--force` | Force the optimizer to ignore the cache and re-bundle (experimental)(`boolean`) | +| `--emptyOutDir` | Force empty outDir when it's outside of root (`boolean`) | +| `-w, --watch` | Rebuilds when modules have changed on disk (`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 | +>>>>>>> d508009a71058d02563d45e4e519f44453d414c0 ## 其他 {#others} diff --git a/guide/troubleshooting.md b/guide/troubleshooting.md index 46a2d952..b17086ab 100644 --- a/guide/troubleshooting.md +++ b/guide/troubleshooting.md @@ -144,7 +144,33 @@ import './Foo.js' // 应该为 './foo.js' 在 Vite 中通过一个哈希值来决定优化后的依赖项是否有效,这个值取决于包锁定的内容、应用于依赖项的补丁以及 Vite 配置文件中影响 node_modules 打包的选项。这意味着,当使用像 [npm overrides](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides) 这样的功能覆盖依赖项时,Vite 将检测到,并在下一次服务器启动时重新打包您的依赖项。当您使用像 [npm link](https://docs.npmjs.com/cli/v9/commands/npm-link) 这样的功能时,Vite 不会使依赖项无效。如果您链接或取消链接一个依赖项,那么您需要使用 `vite --force` 在下一次服务器启动时强制重新预构建。我们建议使用 overrides,它们现在被每个包管理器所支持(还可以参见 [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides) 和 [yarn resolutions](https://yarnpkg.com/configuration/manifest/#resolutions))。 +<<<<<<< HEAD ## 其他 {#others} +======= +## 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 +>>>>>>> d508009a71058d02563d45e4e519f44453d414c0 ### Module externalized for browser compatibility {#module-externalized-for-browser-compatibility} diff --git a/index.md b/index.md index e7d1eec5..0ba59016 100644 --- a/index.md +++ b/index.md @@ -21,6 +21,9 @@ hero: - theme: alt text: 在 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 + + + + + + + + + + + + + + + + + + + + + + + +