Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vitejs/vite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: [email protected]
Choose a base ref
...
head repository: vitejs/vite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: [email protected]
Choose a head ref

Commits on May 18, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    87bf0d8 View commit details

Commits on May 19, 2021

  1. Copy the full SHA
    06b9935 View commit details

Commits on May 21, 2021

  1. Copy the full SHA
    b31604e View commit details
  2. Copy the full SHA
    05bd96e View commit details
  3. fix(plugin-legacy): respect custom filenames formats, fix #2356 (#2641)

    Co-authored-by: Shinigami <chrissi92@hotmail.de>
    anncwb and Shinigami92 authored May 21, 2021
    Copy the full SHA
    d852731 View commit details

Commits on May 22, 2021

  1. Copy the full SHA
    ba8b7af View commit details

Commits on May 23, 2021

  1. Copy the full SHA
    5979d0e View commit details
  2. Copy the full SHA
    cf1632e View commit details
  3. Copy the full SHA
    9484c0f View commit details
  4. feat: support serving index.html in middleware mode (#2871)

    * feat: support for serving `index.html` in middleware mode
    
    * docs: document `server.middlewareMode`
    meowtec authored May 23, 2021
    Copy the full SHA
    b1598ce View commit details
  5. Copy the full SHA
    2671546 View commit details
  6. fix: do not cache module while the file contains import.meta.glob (#3005

    )
    
    Co-authored-by: ygj6 <ygj@54321>
    ygj6 and ygj6 authored May 23, 2021
    Copy the full SHA
    e7b8f41 View commit details
  7. fix(preview): #3487 preview should serve latest content by default (#…

    …3488)
    
    Co-authored-by: fengjianlin <fengjianlin@moyi365.com>
    Sociosarbis and fengjianlin authored May 23, 2021
    Copy the full SHA
    9a4183d View commit details
  8. Copy the full SHA
    65d333d View commit details

Commits on May 24, 2021

  1. Copy the full SHA
    13bda33 View commit details
  2. Copy the full SHA
    3475351 View commit details
  3. chore: new sponsor

    yyx990803 committed May 24, 2021
    Copy the full SHA
    1538e8f View commit details
  4. Copy the full SHA
    496e26e View commit details

Commits on May 25, 2021

  1. Copy the full SHA
    c9da635 View commit details
  2. Copy the full SHA
    07ad2b4 View commit details
  3. Copy the full SHA
    e344cdd View commit details
  4. Copy the full SHA
    9d97b6d View commit details
  5. release: v2.3.4

    antfu committed May 25, 2021
    Copy the full SHA
    9d940e2 View commit details
  6. release: create-app@2.3.2

    antfu committed May 25, 2021
    Copy the full SHA
    37f5161 View commit details
Showing with 412 additions and 95 deletions.
  1. +2 −2 docs/.vitepress/theme/index.js
  2. +6 −1 docs/.vitepress/theme/sponsors.css
  3. +8 −0 docs/.vitepress/theme/sponsors.json
  4. +36 −0 docs/config/index.md
  5. +7 −1 docs/guide/features.md
  6. +1 −0 docs/guide/index.md
  7. +8 −1 docs/guide/ssr.md
  8. +2 −2 docs/index.md
  9. +79 −0 docs/public/mux.svg
  10. +9 −0 packages/create-app/CHANGELOG.md
  11. +1 −1 packages/create-app/package.json
  12. +1 −1 packages/create-app/template-lit-element-ts/package.json
  13. +1 −0 packages/create-app/template-lit-element-ts/src/vite-env.d.ts
  14. +0 −1 packages/create-app/template-lit-element-ts/tsconfig.json
  15. +1 −1 packages/create-app/template-lit-element/package.json
  16. +1 −1 packages/create-app/template-preact-ts/package.json
  17. +1 −0 packages/create-app/template-preact-ts/src/vite-env.d.ts
  18. +0 −1 packages/create-app/template-preact-ts/tsconfig.json
  19. +1 −1 packages/create-app/template-preact/package.json
  20. +1 −1 packages/create-app/template-react-ts/package.json
  21. +1 −0 packages/create-app/template-react-ts/src/vite-env.d.ts
  22. +0 −1 packages/create-app/template-react-ts/tsconfig.json
  23. +1 −1 packages/create-app/template-react/package.json
  24. +1 −1 packages/create-app/template-svelte-ts/package.json
  25. 0 packages/create-app/template-svelte-ts/src/{global.d.ts → vite-env.d.ts}
  26. +1 −1 packages/create-app/template-svelte/package.json
  27. 0 packages/create-app/template-svelte/src/{global.d.ts → vite-env.d.ts}
  28. +1 −1 packages/create-app/template-vanilla-ts/package.json
  29. +1 −0 packages/create-app/template-vanilla-ts/src/vite-env.d.ts
  30. +0 −1 packages/create-app/template-vanilla-ts/tsconfig.json
  31. +1 −1 packages/create-app/template-vanilla/package.json
  32. +1 −1 packages/create-app/template-vue-ts/package.json
  33. +1 −0 packages/create-app/template-vue-ts/src/vite-env.d.ts
  34. +1 −2 packages/create-app/template-vue-ts/tsconfig.json
  35. +1 −1 packages/create-app/template-vue/package.json
  36. +7 −0 packages/playground/css/__tests__/css.spec.ts
  37. +3 −0 packages/playground/css/imported-without-variable.css
  38. +4 −0 packages/playground/css/index.html
  39. +2 −0 packages/playground/css/main.js
  40. +16 −2 packages/playground/glob-import/__tests__/glob-import.spec.ts
  41. +1 −0 packages/playground/legacy/package.json
  42. +15 −0 packages/playground/legacy/vite.config-custom-filename.js
  43. +1 −1 packages/playground/ssr-react/server.js
  44. +1 −1 packages/playground/ssr-vue/server.js
  45. +1 −1 packages/playground/worker/__tests__/worker.spec.ts
  46. +31 −8 packages/plugin-legacy/index.js
  47. +28 −0 packages/vite/CHANGELOG.md
  48. +4 −1 packages/vite/client.d.ts
  49. +1 −1 packages/vite/package.json
  50. +1 −1 packages/vite/rollup.config.js
  51. +16 −2 packages/vite/src/node/cli.ts
  52. +14 −17 packages/vite/src/node/plugins/asset.ts
  53. +28 −10 packages/vite/src/node/plugins/css.ts
  54. +7 −2 packages/vite/src/node/plugins/dataUri.ts
  55. +8 −3 packages/vite/src/node/plugins/importAnalysis.ts
  56. +6 −1 packages/vite/src/node/plugins/manifest.ts
  57. +11 −4 packages/vite/src/node/plugins/worker.ts
  58. +5 −3 packages/vite/src/node/preview.ts
  59. +12 −4 packages/vite/src/node/server/hmr.ts
  60. +12 −7 packages/vite/src/node/server/index.ts
4 changes: 2 additions & 2 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ export default {
},
[h('span', 'Sponsors')]
),
...sponsors.map(({ href, src, name }) =>
...sponsors.map(({ href, src, name, id }) =>
h(
'a',
{
@@ -28,7 +28,7 @@ export default {
rel: 'noopener',
'aria-label': 'sponsor-img'
},
[h('img', { src, alt: name })]
[h('img', { src, alt: name, id: `sponsor-${id}` })]
)
)
])
7 changes: 6 additions & 1 deletion docs/.vitepress/theme/sponsors.css
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@

.sponsors img {
max-width: 200px;
max-height: 40px;
height: 40px;
display: block;
margin: 1.25rem 0;
}
@@ -29,3 +29,8 @@
font-size: 1.2rem;
border: none;
}

/* special cases */
#sponsor-mux {
padding: 5px 0;
}
8 changes: 8 additions & 0 deletions docs/.vitepress/theme/sponsors.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[
{
"id": "tailwind",
"name": "Tailwind Labs",
"href": "https://tailwindcss.com",
"src": "/tailwind-labs.svg"
},
{
"id": "vuejobs",
"name": "Vue Jobs",
"href": "https://vuejobs.com/?ref=vuejs",
"src": "/vuejobs.png"
},
{
"id": "mux",
"name": "Mux",
"href": "https://mux.com",
"src": "/mux.svg"
}
]
36 changes: 36 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
@@ -430,6 +430,42 @@ export default async ({ command, mode }) => {

File system watcher options to pass on to [chokidar](https://github.com/paulmillr/chokidar#api).

### server.middlewareMode

- **Type:** `'ssr' | 'html'`

Create Vite server in middleware mode. (without a HTTP server)

- `'ssr'` will disable Vite's own HTML serving logic so that you should serve `index.html` manually.
- `'html'` will enable Vite's own HTML serving logic.

- **Related:** [SSR - Setting Up the Dev Server](/guide/ssr#setting-up-the-dev-server)

- **Example:**
```js
const express = require('express')
const { createServer: createViteServer } = require('vite')

async function createServer() {
const app = express()

// Create vite server in middleware mode.
const vite = await createViteServer({
server: { middlewareMode: 'ssr' }
})
// Use vite's connect instance as middleware
app.use(vite.middlewares)

app.use('*', async (req, res) => {
// If `middlewareMode` is `'ssr'`, should serve `index.html` here.
// If `middlewareMode` is `'html'`, there is no need to serve `index.html`
// because Vite will do that.
})
}

createServer()
```

### server.fsServe.strict

- **Experimental**
8 changes: 7 additions & 1 deletion docs/guide/features.md
Original file line number Diff line number Diff line change
@@ -38,7 +38,13 @@ Note that because `esbuild` only performs transpilation without type information

### Client Types

Vite's default types are for its Node.js API. To shim the environment of client side code in a Vite application, add `vite/client` to `compilerOptions.types` of your `tsconfig`:
Vite's default types are for its Node.js API. To shim the environment of client side code in a Vite application, add a `d.ts` declaration file:

```typescript
/// <reference types="vite/client" />
```

Also, you can add `vite/client` to `compilerOptions.types` of your `tsconfig`:

```json
{
1 change: 1 addition & 0 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ yarn create @vitejs/app my-vue-app --template vue
Supported template presets include:

- `vanilla`
- `vanilla-ts`
- `vue`
- `vue-ts`
- `react`
9 changes: 8 additions & 1 deletion docs/guide/ssr.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,10 @@ SSR specifically refers to front-end frameworks (for example React, Preact, Vue,
The following guide also assumes prior experience working with SSR in your framework of choice, and will only focus on Vite-specific integration details.
:::

:::warning Low-level API
This is a low-level API meant for library and framework authors. If your goal is to create an application, make sure to check out the higher-level SSR plugins and tools at [Awesome Vite SSR section](https://github.com/vitejs/awesome-vite#ssr) first. That said, many applications are successfully built directly on top of Vite's native low-level API.
:::

:::tip Help
If you have questions, the community is usually helpful at [Vite Discord's #ssr channel](https://discord.gg/PkbxgzPhJv).
:::
@@ -71,8 +75,11 @@ async function createServer() {

// Create vite server in middleware mode. This disables Vite's own HTML
// serving logic and let the parent server take control.
//
// If you want to use Vite's own HTML serving logic (using Vite as
// a development middleware), using 'html' instead.
const vite = await createViteServer({
server: { middlewareMode: true }
server: { middlewareMode: 'ssr' }
})
// use vite's connect instance as middleware
app.use(vite.middlewares)
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ footer: MIT Licensed | Copyright © 2019-present Evan You & Vite Contributors

<div class="frontpage sponsors">
<h2>Sponsors</h2>
<a v-for="{ href, src, name } of sponsors" :href="href" target="_blank" rel="noopener" aria-label="sponsor-img">
<img :src="src" :alt="name">
<a v-for="{ href, src, name, id } of sponsors" :href="href" target="_blank" rel="noopener" aria-label="sponsor-img">
<img :src="src" :alt="name" :id="`sponsor-${id}`">
</a>
<br>
<a href="https://github.com/sponsors/yyx990803" target="_blank" rel="noopener">Become a sponsor on GitHub</a>
79 changes: 79 additions & 0 deletions docs/public/mux.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions packages/create-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [2.3.2](https://github.com/vitejs/vite/compare/create-app@2.3.1...create-app@2.3.2) (2021-05-25)


### Features

* **create-app:** improve client types ([#3214](https://github.com/vitejs/vite/issues/3214)) ([ba8b7af](https://github.com/vitejs/vite/commit/ba8b7afa650277b7218e0bd53564b5fb45bf4549))



## [2.3.1](https://github.com/vitejs/vite/compare/create-app@2.3.0...create-app@2.3.1) (2021-05-17)


2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vitejs/create-app",
"version": "2.3.1",
"version": "2.3.2",
"license": "MIT",
"author": "Evan You",
"bin": {
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element-ts/package.json
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
"lit-element": "^2.4.0"
},
"devDependencies": {
"vite": "^2.3.3",
"vite": "^2.3.4",
"typescript": "^4.1.3"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-lit-element-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
"compilerOptions": {
"module": "esnext",
"lib": ["es2017", "dom", "dom.iterable"],
"types": ["vite/client"],
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./types",
2 changes: 1 addition & 1 deletion packages/create-app/template-lit-element/package.json
Original file line number Diff line number Diff line change
@@ -16,6 +16,6 @@
"lit-element": "^2.4.0"
},
"devDependencies": {
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-preact-ts/package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@
"devDependencies": {
"@preact/preset-vite": "^2.0.0",
"typescript": "^4.1.3",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
1 change: 1 addition & 0 deletions packages/create-app/template-preact-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-preact-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
2 changes: 1 addition & 1 deletion packages/create-app/template-preact/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
},
"devDependencies": {
"@preact/preset-vite": "^2.0.0",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-react-ts/package.json
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@
"@types/react-dom": "^17.0.0",
"@vitejs/plugin-react-refresh": "^1.3.1",
"typescript": "^4.1.2",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
1 change: 1 addition & 0 deletions packages/create-app/template-react-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-react-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vite/client"],
"allowJs": false,
"skipLibCheck": false,
"esModuleInterop": false,
2 changes: 1 addition & 1 deletion packages/create-app/template-react/package.json
Original file line number Diff line number Diff line change
@@ -12,6 +12,6 @@
},
"devDependencies": {
"@vitejs/plugin-react-refresh": "^1.3.1",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@
"svelte": "^3.37.0",
"svelte-preprocess": "^4.7.2",
"typescript": "^4.2.4",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-svelte/package.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.7",
"svelte": "^3.37.0",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@
},
"devDependencies": {
"typescript": "^4.2.3",
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
1 change: 1 addition & 0 deletions packages/create-app/template-vanilla-ts/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
1 change: 0 additions & 1 deletion packages/create-app/template-vanilla-ts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"types": ["vite/client"],
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
2 changes: 1 addition & 1 deletion packages/create-app/template-vanilla/package.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@
"serve": "vite preview"
},
"devDependencies": {
"vite": "^2.3.3"
"vite": "^2.3.4"
}
}
Loading