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: v4.3.9
Choose a base ref
...
head repository: vitejs/vite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3b47e34af89b8220c0aeb119f813e8315e98668e
Choose a head ref

Commits on May 27, 2023

  1. docs: update root documentation to include vite config file location (#…

    …13345)
    
    Co-authored-by: patak <matias.capeletto@gmail.com>
    Ph0tonic and patak-dev authored May 27, 2023
    Copy the full SHA
    d9702c4 View commit details

Commits on May 29, 2023

  1. release: create-vite@4.3.2

    patak-dev committed May 29, 2023
    Copy the full SHA
    5c3fa05 View commit details

Commits on May 30, 2023

  1. Copy the full SHA
    d1cb99e View commit details

Commits on May 31, 2023

  1. Copy the full SHA
    2497756 View commit details
  2. Copy the full SHA
    aec1c1d View commit details
  3. Copy the full SHA
    2872d55 View commit details

Commits on Jun 1, 2023

  1. docs(legacy): add test case to ensure correct csp hashes in readme.md (

    …#13384)
    
    Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
    KAROTT7 and sapphi-red authored Jun 1, 2023
    Copy the full SHA
    bf0cd25 View commit details

Commits on Jun 3, 2023

  1. Copy the full SHA
    20b0cae View commit details
  2. Copy the full SHA
    1197b24 View commit details
  3. Copy the full SHA
    b28c847 View commit details
  4. Copy the full SHA
    471fba2 View commit details

Commits on Jun 5, 2023

  1. Copy the full SHA
    728d090 View commit details
  2. Copy the full SHA
    b93242e View commit details
  3. Copy the full SHA
    1e299cc View commit details

Commits on Jun 6, 2023

  1. feat(importMetaGlob): support sub imports pattern (#12467)

    Co-authored-by: patak <matias.capeletto@gmail.com>
    sun0day and patak-dev authored Jun 6, 2023
    Copy the full SHA
    e355c9c View commit details
  2. Copy the full SHA
    aa1776f View commit details
  3. Copy the full SHA
    998512b View commit details
  4. Copy the full SHA
    a3ff501 View commit details
  5. Copy the full SHA
    a11b6f6 View commit details
  6. Copy the full SHA
    b9a6ba0 View commit details
  7. Copy the full SHA
    4a06e66 View commit details
  8. feat(css): support at import preprocessed styles (#8400)

    Co-authored-by: bluwy <bjornlu.dev@gmail.com>
    poyoho and bluwy authored Jun 6, 2023
    Copy the full SHA
    2bd6077 View commit details
  9. docs(chunkSplitting): add manualChunks object form syntax warning w…

    …hen it is used with the `splitVendorChunk` plugin (#13431)
    
    Co-authored-by: patak <matias.capeletto@gmail.com>
    Ilanaya and patak-dev authored Jun 6, 2023
    Copy the full SHA
    17511e0 View commit details
  10. Copy the full SHA
    00ee8c1 View commit details
  11. Copy the full SHA
    5503198 View commit details

Commits on Jun 7, 2023

  1. refactor: normalize fs/promises usage (#13441)

    花果山大圣 authored Jun 7, 2023
    Copy the full SHA
    f201805 View commit details
  2. Copy the full SHA
    2218099 View commit details
  3. Copy the full SHA
    7792515 View commit details
  4. Copy the full SHA
    367920b View commit details
  5. Copy the full SHA
    d814d6c View commit details

Commits on Jun 8, 2023

  1. Copy the full SHA
    93eed46 View commit details
  2. Copy the full SHA
    54ab3c8 View commit details
  3. fix(deps): update all non-major dependencies (#13059)

    Co-authored-by: bluwy <bjornlu.dev@gmail.com>
    renovate[bot] and bluwy authored Jun 8, 2023
    Copy the full SHA
    123ef4c View commit details
  4. Copy the full SHA
    d458ccd View commit details
  5. Copy the full SHA
    43cbbcf View commit details
  6. Copy the full SHA
    0464398 View commit details

Commits on Jun 9, 2023

  1. Copy the full SHA
    0c673b0 View commit details
  2. Copy the full SHA
    2c0faba View commit details
  3. docs: reword docs/config/Async Config (#13437)

    Co-authored-by: patak <matias.capeletto@gmail.com>
    oliver-dvorski and patak-dev authored Jun 9, 2023
    Copy the full SHA
    ebb8e29 View commit details
  4. Copy the full SHA
    3a98558 View commit details
  5. 2
    Copy the full SHA
    ff3ce31 View commit details

Commits on Jun 10, 2023

  1. Copy the full SHA
    127c334 View commit details

Commits on Jun 11, 2023

  1. Copy the full SHA
    ea1bcc9 View commit details
  2. Copy the full SHA
    2aab455 View commit details
  3. refactor(build): type rollup output (#13447)

    花果山大圣 authored Jun 11, 2023
    Copy the full SHA
    5ee6fd2 View commit details

Commits on Jun 12, 2023

  1. Copy the full SHA
    bd09248 View commit details
  2. Copy the full SHA
    091ee95 View commit details
  3. Copy the full SHA
    dc597bd View commit details
  4. Copy the full SHA
    b70e783 View commit details

Commits on Jun 13, 2023

  1. Copy the full SHA
    6a87c65 View commit details
Showing with 5,149 additions and 2,302 deletions.
  1. +5 −1 .eslintrc.cjs
  2. +1 −1 .github/ISSUE_TEMPLATE/bug_report.yml
  3. +1 −2 .github/renovate.json5
  4. +1 −1 .github/workflows/ci.yml
  5. +1 −1 CONTRIBUTING.md
  6. +5 −0 docs/.vitepress/config.ts
  7. +42 −7 docs/.vitepress/theme/composables/sponsor.ts
  8. +4 −0 docs/.vitepress/theme/styles/vars.css
  9. +2 −2 docs/config/build-options.md
  10. +10 −0 docs/config/dep-optimization-options.md
  11. +3 −3 docs/config/index.md
  12. +11 −7 docs/config/server-options.md
  13. +42 −0 docs/config/shared-options.md
  14. +2 −0 docs/guide/api-hmr.md
  15. +4 −0 docs/guide/api-javascript.md
  16. +1 −1 docs/guide/api-plugin.md
  17. +7 −1 docs/guide/build.md
  18. +18 −0 docs/guide/features.md
  19. +6 −2 docs/guide/index.md
  20. +27 −0 docs/guide/philosophy.md
  21. +28 −0 docs/guide/troubleshooting.md
  22. +1 −0 docs/public/astro.svg
  23. +1 −0 docs/public/nuxtlabs.svg
  24. +1 −0 docs/public/stackblitz.svg
  25. +26 −26 package.json
  26. +8 −0 packages/create-vite/CHANGELOG.md
  27. +2 −0 packages/create-vite/README.md
  28. +3 −2 packages/create-vite/package.json
  29. +30 −3 packages/create-vite/src/index.ts
  30. +2 −2 packages/create-vite/template-lit-ts/package.json
  31. +2 −2 packages/create-vite/template-lit/package.json
  32. +2 −2 packages/create-vite/template-preact-ts/package.json
  33. +1 −1 packages/create-vite/template-preact-ts/src/main.tsx
  34. +2 −2 packages/create-vite/template-preact/package.json
  35. +15 −2 packages/create-vite/template-react-ts/.eslintrc.cjs
  36. +8 −8 packages/create-vite/template-react-ts/package.json
  37. +1 −1 packages/create-vite/template-react-ts/src/main.tsx
  38. +6 −1 packages/create-vite/template-react/.eslintrc.cjs
  39. +6 −6 packages/create-vite/template-react/package.json
  40. +28 −0 packages/create-vite/template-solid-ts/README.md
  41. +24 −0 packages/create-vite/template-solid-ts/_gitignore
  42. +13 −0 packages/create-vite/template-solid-ts/index.html
  43. +19 −0 packages/create-vite/template-solid-ts/package.json
  44. +1 −0 packages/create-vite/template-solid-ts/public/vite.svg
  45. +27 −0 packages/create-vite/template-solid-ts/src/App.css
  46. +35 −0 packages/create-vite/template-solid-ts/src/App.tsx
  47. +1 −0 packages/create-vite/template-solid-ts/src/assets/solid.svg
  48. +69 −0 packages/create-vite/template-solid-ts/src/index.css
  49. +9 −0 packages/create-vite/template-solid-ts/src/index.tsx
  50. +1 −0 packages/create-vite/template-solid-ts/src/vite-env.d.ts
  51. +26 −0 packages/create-vite/template-solid-ts/tsconfig.json
  52. +10 −0 packages/create-vite/template-solid-ts/tsconfig.node.json
  53. +6 −0 packages/create-vite/template-solid-ts/vite.config.ts
  54. +28 −0 packages/create-vite/template-solid/README.md
  55. +24 −0 packages/create-vite/template-solid/_gitignore
  56. +13 −0 packages/create-vite/template-solid/index.html
  57. +18 −0 packages/create-vite/template-solid/package.json
  58. +1 −0 packages/create-vite/template-solid/public/vite.svg
  59. +27 −0 packages/create-vite/template-solid/src/App.css
  60. +35 −0 packages/create-vite/template-solid/src/App.jsx
  61. +1 −0 packages/create-vite/template-solid/src/assets/solid.svg
  62. +69 −0 packages/create-vite/template-solid/src/index.css
  63. +9 −0 packages/create-vite/template-solid/src/index.jsx
  64. +6 −0 packages/create-vite/template-solid/vite.config.js
  65. +6 −6 packages/create-vite/template-svelte-ts/package.json
  66. +3 −3 packages/create-vite/template-svelte/package.json
  67. +1 −1 packages/create-vite/template-vanilla-ts/package.json
  68. +1 −1 packages/create-vite/template-vanilla/package.json
  69. +4 −4 packages/create-vite/template-vue-ts/package.json
  70. +3 −3 packages/create-vite/template-vue/package.json
  71. +10 −0 packages/plugin-legacy/CHANGELOG.md
  72. +8 −1 packages/plugin-legacy/README.md
  73. +8 −7 packages/plugin-legacy/package.json
  74. +16 −0 packages/plugin-legacy/src/__tests__/readme.spec.ts
  75. +59 −37 packages/plugin-legacy/src/index.ts
  76. +4 −0 packages/plugin-legacy/src/types.ts
  77. +113 −0 packages/vite/CHANGELOG.md
  78. +2 −0 packages/vite/api-extractor.json
  79. +4 −0 packages/vite/client.d.ts
  80. +26 −20 packages/vite/package.json
  81. +1 −0 packages/vite/rollup.config.ts
  82. +25 −0 packages/vite/scripts/api-extractor.ts
  83. +19 −2 packages/vite/src/client/client.ts
  84. +22 −1 packages/vite/src/node/__tests__/config.spec.ts
  85. +22 −1 packages/vite/src/node/__tests__/plugins/css.spec.ts
  86. +5 −0 packages/vite/src/node/__tests__/plugins/esbuild.spec.ts
  87. +54 −37 packages/vite/src/node/build.ts
  88. +14 −0 packages/vite/src/node/cli.ts
  89. +99 −40 packages/vite/src/node/config.ts
  90. +1 −0 packages/vite/src/node/constants.ts
  91. +2 −0 packages/vite/src/node/index.ts
  92. +7 −5 packages/vite/src/node/optimizer/esbuildDepPlugin.ts
  93. +14 −46 packages/vite/src/node/optimizer/index.ts
  94. +173 −0 packages/vite/src/node/optimizer/resolve.ts
  95. +4 −3 packages/vite/src/node/plugins/asset.ts
  96. +295 −19 packages/vite/src/node/plugins/css.ts
  97. +3 −3 packages/vite/src/node/plugins/define.ts
  98. +22 −15 packages/vite/src/node/plugins/esbuild.ts
  99. +15 −7 packages/vite/src/node/plugins/html.ts
  100. +25 −14 packages/vite/src/node/plugins/importAnalysis.ts
  101. +29 −8 packages/vite/src/node/plugins/importAnalysisBuild.ts
  102. +20 −9 packages/vite/src/node/plugins/importMetaGlob.ts
  103. +1 −1 packages/vite/src/node/plugins/index.ts
  104. +3 −3 packages/vite/src/node/plugins/loadFallback.ts
  105. +1 −1 packages/vite/src/node/plugins/preAlias.ts
  106. +29 −1 packages/vite/src/node/plugins/reporter.ts
  107. +6 −4 packages/vite/src/node/plugins/resolve.ts
  108. +4 −0 packages/vite/src/node/plugins/splitVendorChunk.ts
  109. +11 −3 packages/vite/src/node/server/hmr.ts
  110. +14 −7 packages/vite/src/node/server/index.ts
  111. +1 −1 packages/vite/src/node/server/middlewares/error.ts
  112. +11 −1 packages/vite/src/node/server/middlewares/indexHtml.ts
  113. +14 −5 packages/vite/src/node/server/middlewares/proxy.ts
  114. +10 −5 packages/vite/src/node/server/middlewares/static.ts
  115. +33 −8 packages/vite/src/node/server/middlewares/transform.ts
  116. +27 −4 packages/vite/src/node/server/moduleGraph.ts
  117. +69 −23 packages/vite/src/node/server/pluginContainer.ts
  118. +16 −9 packages/vite/src/node/server/sourcemap.ts
  119. +31 −13 packages/vite/src/node/server/transformRequest.ts
  120. +10 −1 packages/vite/src/node/server/ws.ts
  121. +57 −13 packages/vite/src/node/shortcuts.ts
  122. +28 −0 packages/vite/src/node/ssr/__tests__/ssrTransform.spec.ts
  123. +16 −21 packages/vite/src/node/ssr/ssrExternal.ts
  124. +16 −2 packages/vite/src/node/ssr/ssrManifestPlugin.ts
  125. +12 −13 packages/vite/src/node/ssr/ssrTransform.ts
  126. +51 −18 packages/vite/src/node/utils.ts
  127. +23 −0 packages/vite/src/types/lightningcss.d.ts
  128. +2 −1 packages/vite/src/types/package.json
  129. +1 −0 packages/vite/src/types/shims.d.ts
  130. +12 −0 packages/vite/types/customEvent.d.ts
  131. +2 −1 packages/vite/types/package.json
  132. +4 −4 patches/{sirv@2.0.2.patch → sirv@2.0.3.patch}
  133. +2 −2 playground/alias/package.json
  134. +36 −20 playground/assets/__tests__/assets.spec.ts
  135. +13 −1 playground/assets/index.html
  136. +3 −0 playground/assets/static/foo.json
  137. +3 −3 playground/backend-integration/package.json
  138. +1 −1 playground/cli-module/package.json
  139. +1 −1 playground/config/packages/siblings/package.json
  140. +73 −0 playground/css-lightningcss/__tests__/lightningcss.spec.ts
  141. +3 −0 playground/css-lightningcss/composed.module.css
  142. +3 −0 playground/css-lightningcss/composes-path-resolving.module.css
  143. +7 −0 playground/css-lightningcss/external-url.css
  144. +3 −0 playground/css-lightningcss/imported-at-import.css
  145. +12 −0 playground/css-lightningcss/imported.css
  146. +31 −0 playground/css-lightningcss/index.html
  147. +3 −0 playground/css-lightningcss/inline.module.css
  148. +4 −0 playground/css-lightningcss/inlined.css
  149. +3 −0 playground/css-lightningcss/linked-at-import.css
  150. +8 −0 playground/css-lightningcss/linked.css
  151. +32 −0 playground/css-lightningcss/main.js
  152. +3 −0 playground/css-lightningcss/minify.css
  153. +3 −0 playground/css-lightningcss/mod.module.css
  154. BIN playground/css-lightningcss/ok.png
  155. +14 −0 playground/css-lightningcss/package.json
  156. +14 −0 playground/css-lightningcss/vite.config.js
  157. +2 −2 playground/css-sourcemap/package.json
  158. +4 −0 playground/css/__tests__/css.spec.ts
  159. +5 −0 playground/css/imported.scss
  160. +4 −1 playground/css/index.html
  161. +2 −2 playground/css/package.json
  162. +3 −3 playground/css/postcss-caching/css.spec.ts
  163. +19 −0 playground/dynamic-import/__tests__/dynamic-import.spec.ts
  164. +6 −1 playground/env/__tests__/env.spec.ts
  165. +5 −0 playground/env/index.html
  166. +2 −1 playground/env/vite.config.js
  167. +1 −1 playground/extensions/package.json
  168. +2 −2 playground/external/dep-that-imports/package.json
  169. +2 −2 playground/external/dep-that-requires/package.json
  170. +2 −2 playground/external/package.json
  171. +4 −6 playground/fs-serve/__tests__/fs-serve.spec.ts
  172. +4 −0 playground/glob-import/__tests__/glob-import.spec.ts
  173. +1 −0 playground/glob-import/imports-path/bar.js
  174. +1 −0 playground/glob-import/imports-path/foo.js
  175. +10 −0 playground/glob-import/index.html
  176. +3 −0 playground/glob-import/package.json
  177. +41 −17 playground/hmr/__tests__/hmr.spec.ts
  178. +7 −0 playground/hmr/hmr.ts
  179. +5 −0 playground/hmr/issue-3033/a.js
  180. +7 −0 playground/hmr/issue-3033/b.js
  181. +12 −0 playground/hmr/issue-3033/c.js
  182. +2 −0 playground/hmr/issue-3033/index.html
  183. +3 −0 playground/hmr/issue-3033/index.js
  184. +15 −1 playground/html/__tests__/html.spec.ts
  185. +5 −0 playground/html/a á.html
  186. +1 −0 playground/html/vite.config.js
  187. +1 −1 playground/js-sourcemap/__tests__/js-sourcemap.spec.ts
  188. +1 −1 playground/json/package.json
  189. +2 −2 playground/json/server.js
  190. +1 −1 playground/legacy/package.json
  191. +3 −0 playground/lib/package.json
  192. +3 −0 playground/minify/__tests__/minify.spec.ts
  193. +4 −0 playground/minify/dir/module/index.css
  194. +2 −0 playground/minify/dir/module/index.js
  195. +6 −0 playground/minify/dir/module/package.json
  196. +3 −0 playground/minify/main.js
  197. +3 −0 playground/minify/package.json
  198. +2 −0 playground/minify/test.css
  199. +1 −0 playground/minify/vite.config.js
  200. +2 −2 playground/multiple-entrypoints/package.json
  201. +1 −1 playground/object-hooks/package.json
  202. +1 −1 playground/optimize-deps-no-discovery/package.json
  203. +22 −1 playground/optimize-deps/__tests__/optimize-deps.spec.ts
  204. +2 −0 playground/optimize-deps/dep-css-require/mod.cjs
  205. +3 −0 playground/optimize-deps/dep-css-require/mod.module.css
  206. 0 playground/optimize-deps/dep-optimize-exports-with-glob/glob/bar.js
  207. 0 playground/optimize-deps/dep-optimize-exports-with-glob/glob/foo.js
  208. 0 playground/optimize-deps/dep-optimize-exports-with-glob/glob/nested/baz.js
  209. 0 playground/optimize-deps/dep-optimize-exports-with-glob/index.js
  210. 0 playground/optimize-deps/dep-optimize-exports-with-glob/named.js
  211. +11 −0 playground/optimize-deps/dep-optimize-exports-with-glob/package.json
  212. 0 playground/optimize-deps/dep-optimize-with-glob/glob/bar.js
  213. 0 playground/optimize-deps/dep-optimize-with-glob/glob/foo.js
  214. 0 playground/optimize-deps/dep-optimize-with-glob/glob/nested/baz.js
  215. 0 playground/optimize-deps/dep-optimize-with-glob/index.js
  216. 0 playground/optimize-deps/dep-optimize-with-glob/named.js
  217. +6 −0 playground/optimize-deps/dep-optimize-with-glob/package.json
  218. +7 −0 playground/optimize-deps/index.html
  219. +6 −4 playground/optimize-deps/package.json
  220. +2 −0 playground/optimize-deps/vite.config.js
  221. +1 −2 playground/package.json
  222. +1 −1 playground/preload/package.json
  223. +15 −0 playground/proxy-hmr/__tests__/proxy-hmr.spec.ts
  224. +27 −0 playground/proxy-hmr/__tests__/serve.ts
  225. +2 −0 playground/proxy-hmr/index.html
  226. +1 −0 playground/proxy-hmr/other-app/index.html
  227. +11 −0 playground/proxy-hmr/other-app/package.json
  228. +9 −0 playground/proxy-hmr/other-app/vite.config.js
  229. +11 −0 playground/proxy-hmr/package.json
  230. +13 −0 playground/proxy-hmr/vite.config.js
  231. +9 −0 playground/resolve/__tests__/resolve.spec.ts
  232. +3 −0 playground/resolve/exports-with-module-condition-required/index.cjs
  233. +9 −0 playground/resolve/exports-with-module-condition-required/package.json
  234. +1 −0 playground/resolve/exports-with-module-condition/index.esm.js
  235. +2 −0 playground/resolve/exports-with-module-condition/index.js
  236. +1 −0 playground/resolve/exports-with-module-condition/index.mjs
  237. +10 −0 playground/resolve/exports-with-module-condition/package.json
  238. +15 −0 playground/resolve/index.html
  239. +3 −1 playground/resolve/package.json
  240. +1 −0 playground/resolve/vite.config.js
  241. +33 −2 playground/ssr-deps/__tests__/ssr-deps.spec.ts
  242. +10 −0 playground/ssr-deps/index.html
  243. +12 −0 playground/ssr-deps/nested-external-cjs/index.js
  244. +7 −0 playground/ssr-deps/nested-external-cjs/package.json
  245. +2 −0 playground/ssr-deps/non-optimized-with-nested-external/index.js
  246. +2 −1 playground/ssr-deps/non-optimized-with-nested-external/package.json
  247. +1 −1 playground/ssr-deps/package.json
  248. +17 −0 playground/ssr-deps/server.js
  249. +5 −0 playground/ssr-deps/src/app.js
  250. +3 −0 playground/ssr-deps/src/isomorphic-module-browser.js
  251. +3 −0 playground/ssr-deps/src/isomorphic-module-server.js
  252. +4 −1 playground/ssr-html/__tests__/ssr-html.spec.ts
  253. +1 −1 playground/tailwind-sourcemap/package.json
  254. +4 −4 playground/tailwind/package.json
  255. +12 −1 playground/test-utils.ts
  256. +1,841 −1,661 pnpm-lock.yaml
  257. +4 −0 vitest.config.e2e.ts
  258. +1 −0 vitest.config.ts
6 changes: 5 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -135,7 +135,11 @@ module.exports = defineConfig({
},
},
{
files: ['packages/vite/src/types/**', '*.spec.ts'],
files: [
'packages/vite/src/types/**',
'packages/vite/scripts/**',
'*.spec.ts',
],
rules: {
'n/no-extraneous-import': 'off',
},
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ body:
id: system-info
attributes:
label: System Info
description: Output of `npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers`
description: Output of `npx envinfo --system --npmPackages '{vite,@vitejs/*,rollup}' --binaries --browsers`
render: shell
placeholder: System, Binaries, Browsers
validations:
3 changes: 1 addition & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
"labels": ["dependencies"],
"ignorePaths": ["**/__tests__/**"],
"pin": false,
"rangeStrategy": "bump",
"node": false,
"packageRules": [
{
"depTypeList": ["peerDependencies"],
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@7ecfc6730dff8072d1cc5215a24cc9478f55264d # v35.8.0
uses: tj-actions/changed-files@54479c37f5eb47a43e595c6b71e1df2c112ce7f1 # v36.4.1
with:
files: |
docs/**
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Vite Contributing Guide

Hi! We're really excited that you're interested in contributing to Vite! Before submitting your contribution, please read through the following guide.
Hi! We're really excited that you're interested in contributing to Vite! Before submitting your contribution, please read through the following guide. We also suggest you read the [Project Philosophy](https://vitejs.dev/guide/philosophy) in our documentation.

You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll see a Codeflow button on issues to start a PR to fix them. A button will also appear on PRs to review them without needing to check out the branch locally. When using Codeflow, the Vite repository will be cloned for you in an online editor, with the Vite package built in watch mode ready to test your changes. If you'd like to learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).

5 changes: 5 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ export default defineConfig({
ja: { label: '日本語', link: 'https://ja.vitejs.dev' },
es: { label: 'Español', link: 'https://es.vitejs.dev' },
pt: { label: 'Português', link: 'https://pt.vitejs.dev' },
ko: { label: '한국어', link: 'https://ko.vitejs.dev' },
},

themeConfig: {
@@ -234,6 +235,10 @@ export default defineConfig({
text: 'Troubleshooting',
link: '/guide/troubleshooting',
},
{
text: 'Philosophy',
link: '/guide/philosophy',
},
{
text: 'Migration from v3',
link: '/guide/migration',
49 changes: 42 additions & 7 deletions docs/.vitepress/theme/composables/sponsor.ts
Original file line number Diff line number Diff line change
@@ -21,8 +21,27 @@ const data = ref()
const dataHost = 'https://sponsors.vuejs.org'
const dataUrl = `${dataHost}/vite.json`

// no sponsors yet :(
const viteSponsors: Pick<Sponsors, 'gold'> = {
const viteSponsors: Pick<Sponsors, 'special' | 'gold'> = {
special: [
// sponsors patak-dev
{
name: 'StackBlitz',
url: 'https://stackblitz.com',
img: '/stackblitz.svg',
},
// sponsors antfu
{
name: 'NuxtLabs',
url: 'https://nuxtlabs.com',
img: '/nuxtlabs.svg',
},
// sponsors bluwy
{
name: 'Astro',
url: 'https://astro.build',
img: '/astro.svg',
},
],
gold: [],
}

@@ -46,7 +65,12 @@ export function useSponsor() {
function mapSponsors(sponsors: Sponsors) {
return [
{
tier: 'Platinum Sponsor',
tier: 'Special Sponsors',
size: 'big',
items: viteSponsors['special'],
},
{
tier: 'Platinum Sponsors',
size: 'big',
items: mapImgPath(sponsors['platinum']),
},
@@ -58,9 +82,20 @@ function mapSponsors(sponsors: Sponsors) {
]
}

const viteSponsorNames = new Set(
Object.values(viteSponsors).flatMap((sponsors) =>
sponsors.map((s) => s.name),
),
)

/**
* Map Vue/Vite sponsors data to objects and filter out Vite-specific sponsors
*/
function mapImgPath(sponsors: Sponsor[]) {
return sponsors.map((sponsor) => ({
...sponsor,
img: `${dataHost}/images/${sponsor.img}`,
}))
return sponsors
.filter((sponsor) => !viteSponsorNames.has(sponsor.name))
.map((sponsor) => ({
...sponsor,
img: `${dataHost}/images/${sponsor.img}`,
}))
}
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/styles/vars.css
Original file line number Diff line number Diff line change
@@ -114,3 +114,7 @@
.dark .vp-doc .custom-block a {
transition: color 0.25s;
}

.vp-sponsor.aside .vp-sponsor-grid.mini .vp-sponsor-grid-image {
max-width: 124px;
}
4 changes: 2 additions & 2 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
@@ -119,10 +119,10 @@ In this case, you need to set `build.cssTarget` to `chrome61` to prevent vite fr
## build.cssMinify
- **Type:** `boolean`
- **Type:** `boolean | 'esbuild' | 'lightningcss'`
- **Default:** the same as [`build.minify`](#build-minify)
This option allows users to override CSS minification specifically instead of defaulting to `build.minify`, so you can configure minification for JS and CSS separately. Vite uses `esbuild` to minify CSS.
This option allows users to override CSS minification specifically instead of defaulting to `build.minify`, so you can configure minification for JS and CSS separately. Vite uses `esbuild` by default to minify CSS. Set the option to `'lightningcss'` to use [Lightning CSS](https://lightningcss.dev/minification.html) instead. If selected, it can be configured using [`css.lightningcss`](./shared-options.md#css-lightningcss).
## build.sourcemap
10 changes: 10 additions & 0 deletions docs/config/dep-optimization-options.md
Original file line number Diff line number Diff line change
@@ -35,6 +35,16 @@ export default defineConfig({

By default, linked packages not inside `node_modules` are not pre-bundled. Use this option to force a linked package to be pre-bundled.

**Experimental:** If you're using a library with many deep imports, you can also specify a trailing glob pattern to pre-bundle all deep imports at once. This will avoid constantly pre-bundling whenever a new deep import is used. For example:

```js
export default defineConfig({
optimizeDeps: {
include: ['my-lib/components/**/*.vue'],
},
})
```

## optimizeDeps.esbuildOptions

- **Type:** [`EsbuildBuildOptions`](https://esbuild.github.io/api/#simple-options)
6 changes: 3 additions & 3 deletions docs/config/index.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ title: Configuring Vite

# Configuring Vite

When running `vite` from the command line, Vite will automatically try to resolve a config file named `vite.config.js` inside [project root](/guide/#index-html-and-project-root).
When running `vite` from the command line, Vite will automatically try to resolve a config file named `vite.config.js` inside [project root](/guide/#index-html-and-project-root) (other JS and TS extensions are also supported).

The most basic config file looks like this:

@@ -71,7 +71,7 @@ It is important to note that in Vite's API the `command` value is `serve` during

## Async Config

If the config needs to call async function, it can export a async function instead:
If the config needs to call async functions, it can export an async function instead. And this async function can also be passed through `defineConfig` for improved intellisense support:

```js
export default defineConfig(async ({ command, mode }) => {
@@ -98,7 +98,7 @@ export default defineConfig(({ command, mode }) => {
return {
// vite config
define: {
__APP_ENV__: env.APP_ENV,
__APP_ENV__: JSON.stringify(env.APP_ENV),
},
}
})
18 changes: 11 additions & 7 deletions docs/config/server-options.md
Original file line number Diff line number Diff line change
@@ -34,6 +34,13 @@ The second case is when wildcard hosts (e.g. `0.0.0.0`) are used. This is becaus

:::

::: tip Accessing the server on WSL2 from your LAN

When running Vite on WSL2, it is not sufficient to set `host: true` to access the server from your LAN.
See [the WSL document](https://learn.microsoft.com/en-us/windows/wsl/networking#accessing-a-wsl-2-distribution-from-your-local-area-network-lan) for more details.

:::

## server.port

- **Type:** `number`
@@ -240,12 +247,6 @@ async function createServer() {
createServer()
```

## server.base

- **Type:** `string | undefined`

Prepend this folder to http requests, for use when proxying vite as a subfolder. Should start with the `/` character.

## server.fs.strict

- **Type:** `boolean`
@@ -259,6 +260,8 @@ Restrict serving files outside of workspace root.

Restrict files that could be served via `/@fs/`. When `server.fs.strict` is set to `true`, accessing files outside this directory list that aren't imported from an allowed file will result in a 403.

Both directories and files can be provided.

Vite will search for the root of the potential workspace and use it as default. A valid workspace met the following conditions, otherwise will fall back to the [project root](/guide/#index-html-and-project-root).

- contains `workspaces` field in `package.json`
@@ -291,7 +294,8 @@ export default defineConfig({
// search up for workspace root
searchForWorkspaceRoot(process.cwd()),
// your custom rules
'/path/to/custom/allow',
'/path/to/custom/allow_directory',
'/path/to/custom/allow_file.demo',
],
},
},
42 changes: 42 additions & 0 deletions docs/config/shared-options.md
Original file line number Diff line number Diff line change
@@ -210,6 +210,8 @@ Enabling this setting causes vite to determine file identity by the original fil

Configure CSS modules behavior. The options are passed on to [postcss-modules](https://github.com/css-modules/postcss-modules).

This option doesn't have any effect when using [Lightning CSS](../guide/features.md#lightning-css). If enabled, [`css.lightningcss.cssModules`](https://lightningcss.dev/css-modules.html) should be used instead.

## css.postcss

- **Type:** `string | (postcss.ProcessOptions & { plugins?: postcss.AcceptedPlugin[] })`
@@ -264,6 +266,46 @@ export default defineConfig({

Whether to enable sourcemaps during dev.

## css.transformer

- **Experimental**
- **Type:** `'postcss' | 'lightningcss'`
- **Default:** `'postcss'`

Selects the engine used for CSS processing. Check out [Lightning CSS](../guide/features.md#lightning-css) for more information.

## css.lightningcss

- **Experimental**
- **Type:**

```js
import type {
CSSModulesConfig,
Drafts,
Features,
NonStandard,
PseudoClasses,
Targets,
} from 'lightningcss'
```

```js
{
targets?: Targets
include?: Features
exclude?: Features
drafts?: Drafts
nonStandard?: NonStandard
pseudoClasses?: PseudoClasses
unusedSymbols?: string[]
cssModules?: CSSModulesConfig,
// ...
}
```

Configures Lightning CSS. Full transform options can be found in [the Lightning CSS repo](https://github.com/parcel-bundler/lightningcss/blob/master/node/index.d.ts).

## json.namedExports

- **Type:** `boolean`
2 changes: 2 additions & 0 deletions docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
@@ -176,6 +176,8 @@ The following HMR events are dispatched by Vite automatically:
- `'vite:beforePrune'` when modules that are no longer needed are about to be pruned
- `'vite:invalidate'` when a module is invalidated with `import.meta.hot.invalidate()`
- `'vite:error'` when an error occurs (e.g. syntax error)
- `'vite:ws:disconnect'` when the WebSocket connection is lost
- `'vite:ws:connect'` when the WebSocket connection is (re-)established
Custom HMR events can also be sent from plugins. See [handleHotUpdate](./api-plugin#handlehotupdate) for more details.
4 changes: 4 additions & 0 deletions docs/guide/api-javascript.md
Original file line number Diff line number Diff line change
@@ -266,6 +266,10 @@ function mergeConfig(

Deeply merge two Vite configs. `isRoot` represents the level within the Vite config which is being merged. For example, set `false` if you're merging two `build` options.

::: tip NOTE
`mergeConfig` accepts only config in object form. If you have a config in callback form, you should call it before passing into `mergeConfig`.
:::

## `searchForWorkspaceRoot`

**Type Signature:**
2 changes: 1 addition & 1 deletion docs/guide/api-plugin.md
Original file line number Diff line number Diff line change
@@ -345,7 +345,7 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo
- An array of tag descriptor objects (`{ tag, attrs, children }`) to inject to the existing HTML. Each tag can also specify where it should be injected to (default is prepending to `<head>`)
- An object containing both as `{ html, tags }`

By default `order` is `undefined`, with this hook applied after the html has been transformed. In order to inject a script that should go through the Vite plugins pipeline, `order: 'pre'` will apply the hook before processing the HTML. `order: 'post'` applies the hook after all hooks with `order` undefined are applied.
By default `order` is `undefined`, with this hook applied after the HTML has been transformed. In order to inject a script that should go through the Vite plugins pipeline, `order: 'pre'` will apply the hook before processing the HTML. `order: 'post'` applies the hook after all hooks with `order` undefined are applied.

**Basic Example:**

8 changes: 7 additions & 1 deletion docs/guide/build.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ The production bundle assumes support for modern JavaScript. By default, Vite ta

You can specify custom targets via the [`build.target` config option](/config/build-options.md#build-target), where the lowest target is `es2015`.

Note that by default, Vite only handles syntax transforms and **does not cover polyfills by default**. You can check out [Polyfill.io](https://polyfill.io/v3/) which is a service that automatically generates polyfill bundles based on the user's browser UserAgent string.
Note that by default, Vite only handles syntax transforms and **does not cover polyfills**. You can check out [Polyfill.io](https://polyfill.io/v3/) which is a service that automatically generates polyfill bundles based on the user's browser UserAgent string.

Legacy browsers can be supported via [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy), which will automatically generate legacy chunks and corresponding ES language feature polyfills. The legacy chunks are conditionally loaded only in browsers that do not have native ESM support.

@@ -60,6 +60,10 @@ export default defineConfig({

This strategy is also provided as a `splitVendorChunk({ cache: SplitVendorChunkCache })` factory, in case composition with custom logic is needed. `cache.reset()` needs to be called at `buildStart` for build watch mode to work correctly in this case.

::: warning
You should use `build.rollupOptions.output.manualChunks` function form when using this plugin. If the object form is used, the plugin won't have any effect.
:::

## 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`:
@@ -114,6 +118,8 @@ export default defineConfig({

If you specify a different root, remember that `__dirname` will still be the folder of your vite.config.js file when resolving the input paths. Therefore, you will need to add your `root` entry to the arguments for `resolve`.

Note that for HTML files, Vite ignores the name given to the entry in the `rollupOptions.input` object and instead respects the resolved id of the file when generating the HTML asset in the dist folder. This ensures a consistent structure with the way the dev server works.

## Library Mode

When you are developing a browser-oriented library, you are likely spending most of the time on a test/demo page that imports your actual library. With Vite, you can use your `index.html` for that purpose to get the smooth development experience.
18 changes: 18 additions & 0 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
@@ -256,6 +256,24 @@ import otherStyles from './bar.css?inline' // will not be injected
Default and named imports from CSS files (e.g `import style from './foo.css'`) are deprecated since Vite 4. Use the `?inline` query instead.
:::

### Lightning CSS

Starting from Vite 4.4, there is experimental support for [Lightning CSS](https://lightningcss.dev/). You can opt into it by adding [`css.transformer: 'lightningcss'`](../config/shared-options.md#css-transformer) to your config file and install the optional [`lightningcss`](https://www.npmjs.com/package/lightningcss) dependency:

```bash
npm add -D lightningcss
```

If enabled, CSS files will be processed by Lightning CSS instead of PostCSS. To configure it, you can pass Lightning CSS options to the [`css.lightingcss`](../config/shared-options.md#css-lightningcss) config option.

To configure CSS Modules, you'll use [`css.lightningcss.cssModules`](https://lightningcss.dev/css-modules.html) instead of [`css.modules`](../config/shared-options.md#css-modules) (which configures the way PostCSS handles CSS modules).

By default, Vite uses esbuild to minify CSS. Lightning CSS can also be used as the CSS minifier with [`build.cssMinify: 'lightningcss'`](../config/build-options.md#css-minify).

::: tip NOTE
[CSS Pre-processors](#css-pre-processors) aren't supported when using Lightning CSS.
:::

## Static Assets

Importing a static asset will return the resolved public URL when it is served:
Loading