diff --git a/docs/config/index.md b/docs/config/index.md index b380b4b..0583f69 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -8,8 +8,7 @@ When running `vite` from the command line, Vite will automatically try to resolv The most basic config file looks like this: -```js -// vite.config.js +```js [vite.config.js] export default { // config options } diff --git a/docs/guide/api-environment-runtimes.md b/docs/guide/api-environment-runtimes.md index a257bbd..37a5f68 100644 --- a/docs/guide/api-environment-runtimes.md +++ b/docs/guide/api-environment-runtimes.md @@ -150,11 +150,10 @@ Module runner exposes `import` method. When Vite server triggers `full-reload` H ```js import { ModuleRunner, ESModulesEvaluator } from 'vite/module-runner' -import { root, transport } from './rpc-implementation.js' +import { transport } from './rpc-implementation.js' const moduleRunner = new ModuleRunner( { - root, transport, }, new ESModulesEvaluator(), @@ -180,10 +179,6 @@ type ModuleRunnerTransport = unknown // ---cut--- interface ModuleRunnerOptions { - /** - * Root of the project - */ - root: string /** * A set of methods to communicate with the server. */ @@ -294,7 +289,6 @@ const transport = { const runner = new ModuleRunner( { - root: fileURLToPath(new URL('./', import.meta.url)), transport, }, new ESModulesEvaluator(), @@ -362,7 +356,6 @@ import { ESModulesEvaluator, ModuleRunner } from 'vite/module-runner' export const runner = new ModuleRunner( { - root: fileURLToPath(new URL('./', import.meta.url)), transport: { async invoke(data) { const response = await fetch(`http://my-vite-server/invoke`, { diff --git a/docs/guide/build.md b/docs/guide/build.md index d0c1da7..e08ad32 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -71,7 +71,7 @@ window.addEventListener('vite:preloadError', (event) => { When a new deployment occurs, the hosting service may delete the assets from previous deployments. As a result, a user who visited your site before the new deployment might encounter an import error. This error happens because the assets running on that user's device are outdated and it tries to import the corresponding old chunk, which is deleted. This event is useful for addressing this situation. -## Rebuild on files changes +## Rebuild on Files Changes You can enable rollup watcher with `vite build --watch`. Or, you can directly adjust the underlying [`WatcherOptions`](https://rollupjs.org/configuration-options/#watch) via `build.watch`: diff --git a/docs/guide/philosophy.md b/docs/guide/philosophy.md index 9e40128..ccceeb7 100644 --- a/docs/guide/philosophy.md +++ b/docs/guide/philosophy.md @@ -18,7 +18,7 @@ When adding new features, these patterns are followed to create a future-proof A Vite has been focused on performance since its [origins](./why.md). Its dev server architecture allows HMR that stays fast as projects scale. Vite uses native tools like [esbuild](https://esbuild.github.io/) and [SWC](https://github.com/vitejs/vite-plugin-react-swc) to implement intensive tasks but keeps the rest of the code in JS to balance speed with flexibility. When needed, framework plugins will tap into [Babel](https://babeljs.io/) to compile user code. And during build time Vite currently uses [Rollup](https://rollupjs.org/) where bundling size and having access to a wide ecosystem of plugins are more important than raw speed. Vite will continue to evolve internally, using new libraries as they appear to improve DX while keeping its API stable. -## Building Frameworks on top of Vite +## Building Frameworks on Top of Vite Although Vite can be used by users directly, it shines as a tool to create frameworks. Vite core is framework agnostic, but there are polished plugins for each UI framework. Its [JS API](./api-javascript.md) allows App Framework authors to use Vite features to create tailored experiences for their users. Vite includes support for [SSR primitives](./ssr.md), usually present in higher-level tools but fundamental to building modern web frameworks. And Vite plugins complete the picture by offering a way to share between frameworks. Vite is also a great fit when paired with [Backend frameworks](./backend-integration.md) like [Ruby](https://vite-ruby.netlify.app/) and [Laravel](https://laravel.com/docs/10.x/vite). diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index 1804b58..051ca18 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -172,7 +172,7 @@ You will need to access the file with `http` protocol. The easiest way to achiev The hash key used to invalidate optimized dependencies depends 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 +## 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: diff --git a/docs/package.json b/docs/package.json index 6c30ce7..ee60093 100644 --- a/docs/package.json +++ b/docs/package.json @@ -8,11 +8,11 @@ "docs-serve": "vitepress serve" }, "devDependencies": { - "@shikijs/vitepress-twoslash": "^1.24.0", + "@shikijs/vitepress-twoslash": "^1.24.4", "@types/express": "^4.17.21", "feed": "^4.2.2", "vitepress": "^1.5.0", - "vitepress-plugin-group-icons": "^1.3.1", + "vitepress-plugin-group-icons": "^1.3.2", "vue": "^3.5.13" } }