Skip to content

Commit

Permalink
Merge commit '69e9090ce144c81d1975902c15cd0eb497666c14'
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa-nematpour committed Dec 24, 2024
2 parents febf73e + 69e9090 commit 43d7535
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 15 deletions.
3 changes: 1 addition & 2 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 1 addition & 8 deletions docs/guide/api-environment-runtimes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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.
*/
Expand Down Expand Up @@ -294,7 +289,6 @@ const transport = {

const runner = new ModuleRunner(
{
root: fileURLToPath(new URL('./', import.meta.url)),
transport,
},
new ESModulesEvaluator(),
Expand Down Expand Up @@ -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`, {
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/philosophy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit 43d7535

Please sign in to comment.