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 Sep 1, 2021

  1. Copy the full SHA
    fa6475f View commit details
  2. Copy the full SHA
    c53f333 View commit details
  3. Copy the full SHA
    0f1d6be View commit details
  4. Copy the full SHA
    1012367 View commit details
  5. Copy the full SHA
    de71408 View commit details
  6. release: v2.5.3

    patak-dev committed Sep 1, 2021
    Copy the full SHA
    632b0ea View commit details
  7. Copy the full SHA
    30d756e View commit details
  8. Copy the full SHA
    c87763c View commit details

Commits on Sep 2, 2021

  1. Copy the full SHA
    53271d3 View commit details

Commits on Sep 3, 2021

  1. Copy the full SHA
    59f54dc View commit details

Commits on Sep 4, 2021

  1. Copy the full SHA
    5bc0ffc View commit details
  2. Copy the full SHA
    46ecda4 View commit details

Commits on Sep 6, 2021

  1. fix: sometimes THIS_IS_UNDEFINED warnings were still shown (#4844)

    Yaroslav Dobzhanskij authored Sep 6, 2021
    Copy the full SHA
    8d956f6 View commit details
  2. Copy the full SHA
    1f068fc View commit details
  3. Copy the full SHA
    c588b8f View commit details
  4. Copy the full SHA
    e5b472d View commit details
  5. Copy the full SHA
    cd4f341 View commit details
  6. release: plugin-vue@1.6.1

    yyx990803 committed Sep 6, 2021
    Copy the full SHA
    bc64b88 View commit details
  7. Copy the full SHA
    74af8c4 View commit details
  8. Copy the full SHA
    fdc3212 View commit details
  9. Copy the full SHA
    311026f View commit details

Commits on Sep 7, 2021

  1. release: v2.5.4

    patak-dev committed Sep 7, 2021
    Copy the full SHA
    4227962 View commit details
  2. Copy the full SHA
    be24a59 View commit details
  3. Copy the full SHA
    d13bbb7 View commit details
  4. release: create-vite@2.6.2

    patak-dev committed Sep 7, 2021
    Copy the full SHA
    794f5db View commit details
Showing with 351 additions and 111 deletions.
  1. +1 −1 .gitignore
  2. +2 −2 docs/guide/env-and-mode.md
  3. BIN docs/images/vercel-configuration.png
  4. +1 −1 package.json
  5. +4 −0 packages/create-vite/CHANGELOG.md
  6. +1 −1 packages/create-vite/package.json
  7. +1 −1 packages/create-vite/template-lit-element-ts/package.json
  8. +1 −1 packages/create-vite/template-lit-element/package.json
  9. +1 −1 packages/create-vite/template-preact-ts/package.json
  10. +1 −1 packages/create-vite/template-preact/package.json
  11. +1 −1 packages/create-vite/template-react-ts/package.json
  12. +1 −1 packages/create-vite/template-react/package.json
  13. +1 −1 packages/create-vite/template-svelte-ts/package.json
  14. +1 −1 packages/create-vite/template-svelte/package.json
  15. +1 −1 packages/create-vite/template-vanilla-ts/package.json
  16. +1 −1 packages/create-vite/template-vanilla/package.json
  17. +3 −0 packages/create-vite/template-vue-ts/.vscode/extensions.json
  18. +1 −1 packages/create-vite/template-vue-ts/README.md
  19. +2 −2 packages/create-vite/template-vue-ts/package.json
  20. +3 −0 packages/create-vite/template-vue/.vscode/extensions.json
  21. +7 −0 packages/create-vite/template-vue/README.md
  22. +2 −2 packages/create-vite/template-vue/package.json
  23. +20 −0 packages/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts
  24. +52 −0 packages/playground/legacy/__tests__/ssr/serve.js
  25. +7 −0 packages/playground/legacy/entry-server.js
  26. +14 −0 packages/playground/vue-jsx/Script.vue
  27. +12 −0 packages/playground/vue-jsx/SrcImport.jsx
  28. +1 −0 packages/playground/vue-jsx/SrcImport.vue
  29. +28 −0 packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts
  30. +4 −0 packages/playground/vue-jsx/main.jsx
  31. +2 −1 packages/playground/vue-jsx/package.json
  32. +3 −1 packages/playground/vue-jsx/vite.config.js
  33. +1 −0 packages/playground/worker/__tests__/worker.spec.ts
  34. +19 −0 packages/plugin-legacy/CHANGELOG.md
  35. +21 −6 packages/plugin-legacy/index.js
  36. +1 −1 packages/plugin-legacy/package.json
  37. +9 −0 packages/plugin-vue-jsx/CHANGELOG.md
  38. +1 −1 packages/plugin-vue-jsx/index.js
  39. +1 −1 packages/plugin-vue-jsx/package.json
  40. +10 −0 packages/plugin-vue/CHANGELOG.md
  41. +16 −0 packages/plugin-vue/README.md
  42. +1 −1 packages/plugin-vue/package.json
  43. +8 −1 packages/plugin-vue/src/handleHotUpdate.ts
  44. +8 −3 packages/plugin-vue/src/index.ts
  45. +23 −0 packages/vite/CHANGELOG.md
  46. +0 −27 packages/vite/LICENSE.md
  47. +1 −2 packages/vite/package.json
  48. +3 −1 packages/vite/src/client/overlay.ts
  49. +1 −1 packages/vite/src/node/plugins/css.ts
  50. +1 −1 packages/vite/src/node/plugins/resolve.ts
  51. +10 −7 packages/vite/src/node/plugins/worker.ts
  52. +17 −8 packages/vite/src/node/server/pluginContainer.ts
  53. +8 −7 packages/vite/src/node/ssr/ssrExternal.ts
  54. +1 −1 packages/vite/src/node/utils.ts
  55. +0 −5 packages/vite/types/shims.d.ts
  56. +10 −15 yarn.lock
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -10,4 +10,4 @@ explorations
*.local
/packages/vite/LICENSE
*.cpuprofile
.vscode/
/.vscode/
4 changes: 2 additions & 2 deletions docs/guide/env-and-mode.md
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ Vite exposes env variables on the special **`import.meta.env`** object. Some bui

During production, these env variables are **statically replaced**. It is therefore necessary to always reference them using the full static string. For example, dynamic key access like `import.meta.env[key]` will not work.

It will also replace these strings appearing in JavaScript strings and Vue templates. This should be a rare case, but it can be unintended. There are ways to work around this behavior:
It will also replace these strings appearing in JavaScript strings and Vue templates. This should be a rare case, but it can be unintended. You may see errors like `Missing Semicolon` or `Unexpected token` in this case, for example when `"process.env.NODE_ENV: "` is transformed to `""development": "`. There are ways to work around this behavior:

- For JavaScript strings, you can break the string up with a unicode zero-width space, e.g. `'import.meta\u200b.env.MODE'`.

@@ -44,7 +44,7 @@ VITE_SOME_KEY=123

Only `VITE_SOME_KEY` will be exposed as `import.meta.env.VITE_SOME_KEY` to your client source code, but `DB_PASSWORD` will not.

If you want to customize env variables prefix, see [envPrefix](/config/index#envPrefix) option.
If you want to customize env variables prefix, see [envPrefix](/config/index#envprefix) option.

:::warning SECURITY NOTES

Binary file modified docs/images/vercel-configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@
"ts-jest": "^27.0.4",
"ts-node": "^10.1.0",
"typescript": "^4.3.5",
"vitepress": "^0.16.0",
"vitepress": "^0.17.0",
"yorkie": "^2.0.0"
},
"peerDependencies": {
4 changes: 4 additions & 0 deletions packages/create-vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.6.2](https://github.com/vitejs/vite/compare/create-vite@2.6.1...create-vite@2.6.2) (2021-09-07)



## [2.6.1](https://github.com/vitejs/vite/compare/create-vite@2.5.4...create-vite@2.6.1) (2021-08-31)


2 changes: 1 addition & 1 deletion packages/create-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-vite",
"version": "2.6.1",
"version": "2.6.2",
"license": "MIT",
"author": "Evan You",
"bin": {
2 changes: 1 addition & 1 deletion packages/create-vite/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.5.2",
"vite": "^2.5.4",
"typescript": "^4.3.2"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/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.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/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.3.2",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/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.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/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.3.2",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/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.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte-ts/package.json
Original file line number Diff line number Diff line change
@@ -16,6 +16,6 @@
"svelte-preprocess": "^4.7.2",
"tslib": "^2.2.0",
"typescript": "^4.3.2",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-svelte/package.json
Original file line number Diff line number Diff line change
@@ -10,6 +10,6 @@
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
"svelte": "^3.37.0",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla-ts/package.json
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@
},
"devDependencies": {
"typescript": "^4.3.2",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vanilla/package.json
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@
"serve": "vite preview"
},
"devDependencies": {
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
3 changes: 3 additions & 0 deletions packages/create-vite/template-vue-ts/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar"]
}
2 changes: 1 addition & 1 deletion packages/create-vite/template-vue-ts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vue 3 + Typescript + Vite

This template should help get you started developing with Vue 3 and Typescript in Vite.
This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

4 changes: 2 additions & 2 deletions packages/create-vite/template-vue-ts/package.json
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@
"vue": "^3.2.6"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.6.0",
"@vitejs/plugin-vue": "^1.6.1",
"@vue/compiler-sfc": "^3.2.6",
"typescript": "^4.3.2",
"vite": "^2.5.2",
"vite": "^2.5.4",
"vue-tsc": "^0.2.2"
}
}
3 changes: 3 additions & 0 deletions packages/create-vite/template-vue/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar"]
}
7 changes: 7 additions & 0 deletions packages/create-vite/template-vue/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

## Recommended IDE Setup

- [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=johnsoncodehk.volar)
4 changes: 2 additions & 2 deletions packages/create-vite/template-vue/package.json
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@
"vue": "^3.2.6"
},
"devDependencies": {
"@vitejs/plugin-vue": "^1.6.0",
"@vitejs/plugin-vue": "^1.6.1",
"@vue/compiler-sfc": "^3.2.6",
"vite": "^2.5.2"
"vite": "^2.5.4"
}
}
20 changes: 20 additions & 0 deletions packages/playground/legacy/__tests__/ssr/legacy-ssr.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { isBuild } from '../../../testUtils'
import { port } from './serve'

const url = `http://localhost:${port}`

if (isBuild) {
test('should work', async () => {
await page.goto(url)
expect(await page.textContent('#app')).toMatch('Hello')
})

test('import.meta.env.LEGACY', async () => {
// SSR build is always modern
expect(await page.textContent('#env')).toMatch('false')
})
} else {
// this test doesn't support serve mode
// must contain at least one test
test('should work', () => void 0)
}
52 changes: 52 additions & 0 deletions packages/playground/legacy/__tests__/ssr/serve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// @ts-check
// this is automtically detected by scripts/jestPerTestSetup.ts and will replace
// the default e2e test serve behavior
const path = require('path')

const port = (exports.port = 9527)

/**
* @param {string} root
* @param {boolean} _isProd
*/
exports.serve = async function serve(root, _isProd) {
const { build } = require('vite')
await build({
root,
logLevel: 'silent',
build: {
target: 'esnext',
ssr: 'entry-server.js',
outDir: 'dist/server'
}
})

const express = require('express')
const app = express()

app.use('/', async (_req, res) => {
const { render } = require(path.resolve(
root,
'./dist/server/entry-server.js'
))
const html = await render()
res.status(200).set({ 'Content-Type': 'text/html' }).end(html)
})

return new Promise((resolve, reject) => {
try {
const server = app.listen(port, () => {
resolve({
// for test teardown
async close() {
await new Promise((resolve) => {
server.close(resolve)
})
}
})
})
} catch (e) {
reject(e)
}
})
}
7 changes: 7 additions & 0 deletions packages/playground/legacy/entry-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This counts as 'server-side' rendering, yes?
export async function render() {
return /* html */ `
<div id="app">Hello</div>
<div id="env">${import.meta.env.LEGACY}</div>
`
}
14 changes: 14 additions & 0 deletions packages/playground/vue-jsx/Script.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="jsx">
import { defineComponent, ref } from 'vue'
export default defineComponent(() => {
const count = ref(4)
const inc = () => count.value++
return () => (
<button class="script" onClick={inc}>
script {count.value}
</button>
)
})
</script>
12 changes: 12 additions & 0 deletions packages/playground/vue-jsx/SrcImport.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineComponent, ref } from 'vue'

export default defineComponent(() => {
const count = ref(5)
const inc = () => count.value++

return () => (
<button class="src-import" onClick={inc}>
src import {count.value}
</button>
)
})
1 change: 1 addition & 0 deletions packages/playground/vue-jsx/SrcImport.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script src="./SrcImport.jsx"></script>
28 changes: 28 additions & 0 deletions packages/playground/vue-jsx/__tests__/vue-jsx.spec.ts
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ test('should render', async () => {
expect(await page.textContent('.named-specifier')).toMatch('1')
expect(await page.textContent('.default')).toMatch('2')
expect(await page.textContent('.default-tsx')).toMatch('3')
expect(await page.textContent('.script')).toMatch('4')
expect(await page.textContent('.src-import')).toMatch('5')
expect(await page.textContent('.other-ext')).toMatch('Other Ext')
})

@@ -17,6 +19,10 @@ test('should update', async () => {
expect(await page.textContent('.default')).toMatch('3')
await page.click('.default-tsx')
expect(await page.textContent('.default-tsx')).toMatch('4')
await page.click('.script')
expect(await page.textContent('.script')).toMatch('5')
await page.click('.src-import')
expect(await page.textContent('.src-import')).toMatch('6')
})

if (!isBuild) {
@@ -74,4 +80,26 @@ if (!isBuild) {
// should not affect other components on the page
expect(await page.textContent('.named')).toMatch('1')
})

test('hmr: script in .vue', async () => {
editFile('Script.vue', (code) =>
code.replace('script {count', 'script updated {count')
)
await untilUpdated(() => page.textContent('.script'), 'script updated 4')

expect(await page.textContent('.src-import')).toMatch('6')
})

test('hmr: src import in .vue', async () => {
await page.click('.script')
editFile('SrcImport.jsx', (code) =>
code.replace('src import {count', 'src import updated {count')
)
await untilUpdated(
() => page.textContent('.src-import'),
'src import updated 5'
)

expect(await page.textContent('.script')).toMatch('5')
})
}
4 changes: 4 additions & 0 deletions packages/playground/vue-jsx/main.jsx
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@ import { createApp } from 'vue'
import { Named, NamedSpec, default as Default } from './Comps'
import { default as TsxDefault } from './Comp'
import OtherExt from './OtherExt.tesx'
import JsxScript from './Script.vue'
import JsxSrcImport from './SrcImport.vue'

function App() {
return (
@@ -11,6 +13,8 @@ function App() {
<Default />
<TsxDefault />
<OtherExt />
<JsxScript />
<JsxSrcImport />
</>
)
}
3 changes: 2 additions & 1 deletion packages/playground/vue-jsx/package.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"serve": "vite preview"
},
"devDependencies": {
"@vitejs/plugin-vue-jsx": "^1.0.0"
"@vitejs/plugin-vue-jsx": "^1.0.0",
"@vitejs/plugin-vue": "^1.3.0"
}
}
4 changes: 3 additions & 1 deletion packages/playground/vue-jsx/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const vueJsxPlugin = require('@vitejs/plugin-vue-jsx')
const vuePlugin = require('@vitejs/plugin-vue')

/**
* @type {import('vite').UserConfig}
@@ -7,7 +8,8 @@ module.exports = {
plugins: [
vueJsxPlugin({
include: [/\.tesx$/, /\.[jt]sx$/]
})
}),
vuePlugin()
],
build: {
// to make tests faster
1 change: 1 addition & 0 deletions packages/playground/worker/__tests__/worker.spec.ts
Original file line number Diff line number Diff line change
@@ -65,5 +65,6 @@ if (isBuild) {
expect(content).toMatch(`new SharedWorker("/assets`)
// inlined
expect(content).toMatch(`(window.URL||window.webkitURL).createObjectURL`)
expect(content).toMatch(`window.Blob`)
})
}
Loading