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: FreeJ1nG/vite
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: vitejs/vite
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Dec 10, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    bc7d4dd View commit details
  2. ci: buildless ecosystem ci (vitejs#18525)

    Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
    Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
    3 people authored Dec 10, 2024

    Verified

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

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    87826f5 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8ccd34d View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    0e3eec2 View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    67fa5ad View commit details
  8. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    924b352 View commit details
  9. Verified

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

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

Commits on Dec 11, 2024

  1. Verified

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

Commits on Dec 13, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    638de0f View commit details
  2. Verified

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

Commits on Dec 16, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    30f256e View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    27f691b View commit details
  3. Verified

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7d6dd5d View commit details
  5. fix(optimizer): keep NODE_ENV as-is when keepProcessEnv is true (vi…

    …tejs#18899)
    
    Co-authored-by: Dario Piotrowicz <dario.piotrowicz@gmail.com>
    sapphi-red and dario-piotrowicz authored Dec 16, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8a6bb4e View commit details
  6. Verified

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

Commits on Dec 17, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    62fad6d View commit details
  2. fix(css): skip non css in custom sass importer (vitejs#18970)

    Co-authored-by: 翠 / green <green@sapphi.red>
    hi-ogawa and sapphi-red authored Dec 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    21680bd View commit details
  3. fix(deps): update all non-major dependencies (vitejs#18967)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 17, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d88d000 View commit details
  4. fix: fallback terser to main thread when function options are used (v…

    …itejs#18987)
    
    Co-authored-by: Wout Mertens <Wout.Mertens@gmail.com>
    sapphi-red and wmertens authored Dec 17, 2024

    Verified

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

Commits on Dec 18, 2024

  1. fix(deps): update all non-major dependencies (vitejs#18996)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 18, 2024

    Verified

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

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    3734f80 View commit details
  4. Verified

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

Commits on Dec 19, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    89eea02 View commit details
  2. release: create-vite@6.1.0

    sapphi-red committed Dec 19, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    sapphi-red 翠 / green
    Copy the full SHA
    dc6fc5a View commit details
  3. release: v6.0.4

    sapphi-red committed Dec 19, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    sapphi-red 翠 / green
    Copy the full SHA
    11cd5a4 View commit details

Commits on Dec 20, 2024

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    322503b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4359e0d View commit details
  3. release: v6.0.5

    patak-dev committed Dec 20, 2024
    Copy the full SHA
    49a6be5 View commit details
  4. Verified

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

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

Commits on Dec 23, 2024

  1. Verified

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

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

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

Commits on Dec 24, 2024

  1. fix(deps): update all non-major dependencies (vitejs#19045)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 24, 2024

    Verified

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    e6c2754 View commit details
  3. release: create-vite@6.1.1

    sapphi-red committed Dec 24, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    sapphi-red 翠 / green
    Copy the full SHA
    971e326 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8bfe247 View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    9f10261 View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    902567a View commit details
  7. fix(ssrTransform): preserve line offset when transforming imports (vi…

    …tejs#19004)
    
    Co-authored-by: 翠 / green <green@sapphi.red>
    aleclarson and sapphi-red authored Dec 24, 2024

    Verified

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

Commits on Dec 25, 2024

  1. Verified

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

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    1acea1f View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    afff05c View commit details
  4. fix(css): show correct error when unknown placeholder is used for CSS…

    … modules pattern in lightningcss (vitejs#19070)
    sapphi-red authored Dec 25, 2024

    Verified

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

Commits on Dec 26, 2024

  1. release: v6.0.6

    sapphi-red committed Dec 26, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    sapphi-red 翠 / green
    Copy the full SHA
    5c2b4a0 View commit details
Showing 414 changed files with 14,852 additions and 7,371 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "\U0001F41E Bug report"
description: Report an issue with Vite
labels: [pending triage]
type: Bug
body:
- type: markdown
attributes:
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "\U0001F680 New feature proposal"
description: Propose a new feature to be added to Vite
labels: ["enhancement: pending triage"]
labels: ["pending triage"]
type: Feature
body:
- type: markdown
attributes:
15 changes: 14 additions & 1 deletion .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -9,14 +9,18 @@
"depTypeList": ["peerDependencies"],
"enabled": false,
},
{
"matchDepTypes": ["action"],
"excludePackagePrefixes": ["actions/", "github/"],
"pinDigests": true,
},
],
"ignoreDeps": [
// manually bumping
"esbuild",
"rollup",
"node",
"typescript",
"eslint-plugin-react-hooks", // prevent bumping to messy -rc-<hash>-<date>
"@rollup/plugin-dynamic-import-vars", // prefer version using tinyglobby
"@types/express", // express latest is still on v4, so types should also be v4

@@ -28,4 +32,13 @@
// breaking changes
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)
],
"customManagers": [
{
"customType": "regex",
"fileMatch": ["packages\/create-vite\/src\/index\\.ts$"],
"matchStrings": [
"\/\/\\s*renovate:\\s+datasource=(?<datasource>\\S+)\\s+depName=(?<depName>\\S+)\\s+(?:var|let|const)\\s+\\S+\\s*=\\s*[\"'](?<currentValue>[^\"']+)[\"']",
],
},
],
}
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@bab30c2299617f6615ec02a68b9a40d10bd21366 # v45.0.5
uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
with:
files: |
docs/**
@@ -80,7 +80,7 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@v4
@@ -153,7 +153,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Set node version to 20
uses: actions/setup-node@v4
178 changes: 162 additions & 16 deletions .github/workflows/ecosystem-ci-trigger.yml
Original file line number Diff line number Diff line change
@@ -8,13 +8,22 @@ jobs:
trigger:
runs-on: ubuntu-latest
if: github.repository == 'vitejs/vite' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/ecosystem-ci run')
permissions:
issues: write # to add / delete reactions
pull-requests: write # to read PR data, and to add labels
actions: read # to check workflow status
contents: read # to clone the repo
steps:
- uses: actions/github-script@v7
- name: Check User Permissions
uses: actions/github-script@v7
id: check-permissions
with:
script: |
const user = context.payload.sender.login
console.log(`Validate user: ${user}`)
const additionalAllowedUsers = ['lukastaegert']
let hasTriagePermission = false
try {
const { data } = await github.rest.repos.getCollaboratorPermissionLevel({
@@ -27,25 +36,27 @@ jobs:
console.warn(e)
}
if (hasTriagePermission) {
console.log('Allowed')
if (hasTriagePermission || additionalAllowedUsers.includes(user)) {
console.log('User is allowed. Adding +1 reaction.')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '+1',
})
} else {
console.log('Not allowed')
console.log('User is not allowed. Adding -1 reaction.')
await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: '-1',
})
throw new Error('not allowed')
throw new Error('User does not have the necessary permissions.')
}
- uses: actions/github-script@v7
- name: Get PR Data
uses: actions/github-script@v7
id: get-pr-data
with:
script: |
@@ -55,25 +66,160 @@ jobs:
repo: context.repo.repo,
pull_number: context.issue.number
})
core.setOutput('head_sha', pr.head.sha)
return {
num: context.issue.number,
branchName: pr.head.ref,
repo: pr.head.repo.full_name,
commit: pr.head.sha
commit: pr.head.sha,
repo: pr.head.repo.full_name
}
- name: Check Package Existence
uses: actions/github-script@v7
id: check-package
with:
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
const url = `https://pkg.pr.new/vite@${prData.commit}`
const response = await fetch(url)
console.log(`Package check URL: ${url}, Status: ${response.status}`)
// Add 'rocket' reaction to the issue comment
if (response.status === 404) {
const { data: reaction } = await github.rest.reactions.createForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
content: 'rocket',
})
return { exists: false, reaction: reaction.id }
}
- id: generate-token
uses: tibdex/github-app-token@v2
return { exists: true, reaction: null }
- name: Generate Token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app_id: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_ID }}
installation_retrieval_payload: "${{ github.repository_owner }}/vite-ecosystem-ci"
private_key: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_PRIVATE_KEY }}
- uses: actions/github-script@v7
app-id: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_ID }}
private-key: ${{ secrets.ECOSYSTEM_CI_GITHUB_APP_PRIVATE_KEY }}
repositories: |
vite
vite-ecosystem-ci
- name: Trigger Preview Release (if Package Not Found)
if: fromJSON(steps.check-package.outputs.result).exists == false
uses: actions/github-script@v7
id: trigger-preview-release
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
console.log('Package not found, triggering preview release...')
// Add label "trigger: preview" to the PR
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prData.num,
labels: ['trigger: preview']
})
console.log('Added "trigger: preview" label.')
- name: Wait for Preview Release Completion (if Package Not Found)
if: fromJSON(steps.check-package.outputs.result).exists == false
uses: actions/github-script@v7
id: wait-preview-release
with:
script: |
const prData = ${{ steps.get-pr-data.outputs.result }}
const reaction = ${{ fromJSON(steps.check-package.outputs.result).reaction }}
const workflowFileName = 'preview-release.yml'
const workflow = await github.rest.actions.getWorkflow({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowFileName,
})
const workflowId = workflow.data.id
console.log(`Waiting for workflow ID ${workflowId} to complete...`)
const maxRetries = 60 // Wait up to 10 minutes
const delay = 10000 // 10 seconds
let completed = false
for (let i = 0; i < maxRetries; i++) {
const runsData = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowId,
head_sha: prData.commit,
per_page: 100,
page: 1,
})
const runs = runsData.data.workflow_runs
if (runs.length > 0) {
const latestRun = runs[0]
console.log(`Latest run status: ${latestRun.status}, conclusion: ${latestRun.conclusion}`)
if (latestRun.status === 'completed') {
if (latestRun.conclusion === 'success') {
console.log('Preview release workflow completed successfully.')
completed = true
break
} else if (latestRun.conclusion === 'skipped') {
// noop
} else {
throw new Error('Preview Release workflow failed.')
}
}
}
console.log(`Retrying... (${i + 1}/${maxRetries})`)
await new Promise(resolve => setTimeout(resolve, delay))
}
if (!completed) {
throw new Error('Preview Release workflow did not complete in time.')
}
// Remove the 'rocket' reaction
if (reaction) {
await github.rest.reactions.deleteForIssueComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: context.payload.comment.id,
reaction_id: reaction,
})
console.log('Removed "rocket" reaction.')
}
- name: Checkout
uses: actions/checkout@v4
with:
ref: refs/pull/${{ fromJSON(steps.get-pr-data.outputs.result).num }}/head
fetch-depth: 0

# This step can be removed on May 26 2025
- name: Check Commit Hash Ambiguity
id: check_ambiguity
run: |
HEAD_SHA=${{ steps.get-pr-data.outputs.head_sha }}
COMMIT_SHORT=${HEAD_SHA:0:7}
if git show "$COMMIT_SHORT"; then
echo "COLLISION=false" >> $GITHUB_ENV
else
echo "COLLISION=true" >> $GITHUB_ENV
fi
- name: Trigger Downstream Workflow
uses: actions/github-script@v7
id: trigger
env:
COMMENT: ${{ github.event.comment.body }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
result-encoding: string
script: |
const comment = process.env.COMMENT.trim()
const prData = ${{ steps.get-pr-data.outputs.result }}
@@ -89,7 +235,7 @@ jobs:
prNumber: '' + prData.num,
branchName: prData.branchName,
repo: prData.repo,
commit: prData.commit,
commit: process.env.COLLISION === 'false' ? prData.commit : '',
suite: suite === '' ? '-' : suite
}
})
5 changes: 4 additions & 1 deletion .github/workflows/issue-close-require.yml
Original file line number Diff line number Diff line change
@@ -8,9 +8,12 @@ jobs:
close-issues:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
steps:
- name: needs reproduction
uses: actions-cool/issues-helper@v3
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3
with:
actions: "close-issues"
token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 7 additions & 13 deletions .github/workflows/issue-labeled.yml
Original file line number Diff line number Diff line change
@@ -8,37 +8,31 @@ jobs:
reply-labeled:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
permissions:
issues: write # for actions-cool/issues-helper to update issues
pull-requests: write # for actions-cool/issues-helper to update PRs
steps:
- name: contribution welcome
if: github.event.label.name == 'contribution welcome' || github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v3
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: "pending triage, needs reproduction"

- name: remove pending
if: contains(github.event.label.description, '(priority)') && contains(github.event.issue.labels.*.name, 'pending triage')
uses: actions-cool/issues-helper@v3
if: (github.event.label.name == 'enhancement' || contains(github.event.label.description, '(priority)')) && contains(github.event.issue.labels.*.name, 'pending triage')
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: "pending triage"

- name: remove enhancement pending
if: "(github.event.label.name == 'enhancement' || contains(github.event.label.description, '(priority)')) && contains(github.event.issue.labels.*.name, 'enhancement: pending triage')"
uses: actions-cool/issues-helper@v3
with:
actions: "remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
labels: "enhancement: pending triage"

- name: needs reproduction
if: github.event.label.name == 'needs reproduction'
uses: actions-cool/issues-helper@v3
uses: actions-cool/issues-helper@a610082f8ac0cf03e357eb8dd0d5e2ba075e017e # v3
with:
actions: "create-comment, remove-labels"
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lock-closed-issues.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v5
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-inactive-days: "14"
2 changes: 1 addition & 1 deletion .github/workflows/preview-release.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Install dependencies
run: pnpm install
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4.0.0
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0

- name: Set node version to 20
uses: actions/setup-node@v4
2 changes: 2 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@ jobs:
release:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
permissions:
contents: write # for yyx990803/release-tag to create a release tag
steps:
- uses: actions/checkout@v4

4 changes: 3 additions & 1 deletion .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -12,9 +12,11 @@ jobs:
if: github.repository == 'vitejs/vite'
runs-on: ubuntu-latest
name: Semantic Pull Request
permissions:
pull-requests: read
steps:
- name: Validate PR title
uses: amannn/action-semantic-pull-request@v5
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -13,3 +13,4 @@ playground/html/valid.html
playground/external/public/slash@3.0.0.js
playground/ssr-html/public/slash@3.0.0.js
playground/worker/classic-worker.js
playground/css/weapp.wxss
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs o

## Repo Setup

To develop locally, fork the Vite repository and clone it in your local machine. The Vite repo is a monorepo using pnpm workspaces. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/).
To develop locally, fork the Vite repository and clone it in your local machine. The Vite repo is a monorepo using pnpm workspaces. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/). You can find the required pnpm version in `package.json` under the `packageManager` key.

To develop and test the core `vite` package:

@@ -20,7 +20,7 @@ To develop and test the core `vite` package:

You can alternatively use [Vite.js Docker Dev](https://github.com/nystudio107/vitejs-docker-dev) for a containerized Docker setup for Vite.js development.

> Vite uses pnpm v8. If you are working on multiple projects with different versions of pnpm, it's recommended to enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`.
> If you are working on multiple projects with different versions of pnpm, it's recommended to enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`.
### Ignoring commits when running `git blame`

31 changes: 18 additions & 13 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -232,16 +232,25 @@ export default defineConfig({
sidebar: {
'/guide/': [
{
text: 'Guide',
text: 'Introduction',
items: [
{
text: 'Why Vite',
link: '/guide/why',
},
{
text: 'Getting Started',
link: '/guide/',
},
{
text: 'Philosophy',
link: '/guide/philosophy',
},
{
text: 'Why Vite',
link: '/guide/why',
},
],
},
{
text: 'Guide',
items: [
{
text: 'Features',
link: '/guide/features',
@@ -282,10 +291,6 @@ export default defineConfig({
text: 'Backend Integration',
link: '/guide/backend-integration',
},
{
text: 'Comparisons',
link: '/guide/comparisons',
},
{
text: 'Troubleshooting',
link: '/guide/troubleshooting',
@@ -295,8 +300,8 @@ export default defineConfig({
link: '/guide/performance',
},
{
text: 'Philosophy',
link: '/guide/philosophy',
text: 'Rolldown',
link: '/guide/rolldown',
},
{
text: 'Migration from v5',
@@ -337,7 +342,7 @@ export default defineConfig({
link: '/guide/api-environment',
},
{
text: 'Environment instances',
text: 'Environment Instances',
link: '/guide/api-environment-instances',
},
{
@@ -442,7 +447,7 @@ export default defineConfig({
transformPageData(pageData) {
const canonicalUrl = `${ogUrl}/${pageData.relativePath}`
.replace(/\/index\.md$/, '/')
.replace(/\.md$/, '/')
.replace(/\.md$/, '')
pageData.frontmatter.head ??= []
pageData.frontmatter.head.unshift(
['link', { rel: 'canonical', href: canonicalUrl }],
6 changes: 3 additions & 3 deletions docs/.vitepress/theme/components/AsideSponsors.vue
Original file line number Diff line number Diff line change
@@ -21,14 +21,14 @@ const sponsors = computed(() => {
<template>
<a
class="viteconf"
href="https://viteconf.org/24/replay?utm=vite-sidebar"
href="https://viteconf.org/?utm=vite-sidebar"
target="_blank"
>
<img width="22" height="22" src="/viteconf.svg" alt="ViteConf Logo" />
<span>
<p class="extra-info">Building Together</p>
<p class="heading">ViteConf 2024</p>
<p class="extra-info">Watch the replay!</p>
<p class="heading">ViteConf 2025</p>
<p class="extra-info">First time in-person!</p>
</span>
</a>
<VPDocAsideSponsors v-if="data" :data="sponsors" />
Original file line number Diff line number Diff line change
@@ -437,6 +437,12 @@ const isChromiumBrowser = ref(false)
onMounted(() => {
isChromiumBrowser.value = 'chrome' in window
})
// Check for uwu query
const isUwu = ref(false)
onMounted(() => {
isUwu.value = location.search.includes('?uwu')
})
</script>

<template>
@@ -463,7 +469,12 @@ onMounted(() => {
></div>
</div>
<div class="vite-chip__filter" />
<img src="/logo.svg" alt="Vite Logo" class="vite-chip__logo" />
<img
:src="isUwu ? '/logo-uwu.png' : '/logo.svg'"
:alt="isUwu ? 'Vite Kawaii Logo by @icarusgkx' : 'Vite Logo'"
class="vite-chip__logo"
:class="{ uwu: isUwu }"
/>
</div>
</div>

@@ -509,7 +520,8 @@ onMounted(() => {
bottom: 0;
transform: translate3d(0, 0, 0) scale(1);
transition: transform 0.3s ease-in-out;
background: linear-gradient(
background:
linear-gradient(
130deg,
rgba(61, 61, 61, 0.3) 0%,
rgba(61, 61, 61, 0) 40%
@@ -638,6 +650,10 @@ onMounted(() => {
z-index: 3;
}
.uwu.vite-chip__logo {
width: 134px;
}
&.active {
box-shadow: 0 30px 35px -10px rgba(0, 0, 0, 0.6);
transform: translate3d(0, 0, 0) scale(1);
@@ -698,7 +714,8 @@ onMounted(() => {
opacity: 0.1;
}
background: url('/noise.png'),
background:
url('/noise.png'),
radial-gradient(
circle at right center,
rgb(86, 50, 119) 0%,
@@ -714,7 +731,8 @@ onMounted(() => {
);
@media (min-width: 1024px) {
background: url('/noise.png'),
background:
url('/noise.png'),
radial-gradient(
circle at right center,
rgba(75, 41, 105, 0.5) 0%,
@@ -732,7 +750,8 @@ onMounted(() => {
}
@media (min-width: 1500px) {
background: url('/noise.png'),
background:
url('/noise.png'),
radial-gradient(
circle at right center,
rgba(75, 41, 105, 0.5) 0%,
@@ -750,7 +769,8 @@ onMounted(() => {
}
@media (min-width: 1800px) {
background: url('/noise.png'),
background:
url('/noise.png'),
radial-gradient(
circle at right center,
rgba(75, 41, 105, 0.5) 0%,
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@ import HeroDiagram from './HeroDiagram.vue'
<template>
<div class="hero">
<div class="container">
<!-- ViteConf Replay Button -->
<!-- ViteConf 2025 Button -->
<a
href="https://viteconf.org/24/replay?utm=vite"
href="https://viteconf.org/?utm=vite"
class="hero__pill"
target="_blank"
>
<img src="/viteconf.svg" alt="Viteconf logo" width="20" height="20" />
<span>ViteConf 2024 Talks</span>
<span>ViteConf 2025</span>
</a>

<!-- Heading -->
Original file line number Diff line number Diff line change
@@ -342,7 +342,8 @@ onUnmounted(() => {
bottom: 0;
height: 100%;
border-radius: 12px 0 0 12px;
background: url('/noise.png'),
background:
url('/noise.png'),
radial-gradient(
ellipse 140% 80% at 96% bottom,
#13b351 0%,
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import logoLaravel from './images/laravel.svg'
import logoAdonis from './images/adonis.svg'
import logoEmber from './images/ember.svg'
import logoPreact from './images/preact.svg'
import logoHono from './images/hono.svg'
/**
* The frameworks and tools to display in this section.
@@ -164,6 +165,13 @@ const frameworks: Framework[] = [
url: 'https://emberjs.com/',
visible: ref(false),
},
{
name: 'Hono',
logo: logoHono,
color: '#ff5c13',
url: 'https://hono.dev/',
visible: ref(false),
},
]
// Starting parameters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions docs/.vitepress/theme/composables/sponsor.ts
Original file line number Diff line number Diff line change
@@ -45,12 +45,6 @@ const viteSponsors: Pick<Sponsors, 'special' | 'gold'> = {
url: 'https://nuxtlabs.com',
img: '/nuxtlabs.svg',
},
// sponsors bluwy
{
name: 'Astro',
url: 'https://astro.build',
img: '/astro.svg',
},
],
gold: [
// now automated via sponsors.vuejs.org too
6 changes: 4 additions & 2 deletions docs/.vitepress/theme/styles/landing.css
Original file line number Diff line number Diff line change
@@ -176,7 +176,8 @@ html:has(.landing) {

&.btn--primary {
position: relative;
background: radial-gradient(
background:
radial-gradient(
141.42% 141.42% at 100% 0%,
rgba(255, 255, 255, 0.4) 0%,
rgba(255, 255, 255, 0) 100%
@@ -194,7 +195,8 @@ html:has(.landing) {
box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.75) inset;

&:hover {
background: radial-gradient(
background:
radial-gradient(
141.42% 141.42% at 100% 0%,
rgba(255, 255, 255, 0.5) 0%,
rgba(255, 255, 255, 0) 100%
2 changes: 1 addition & 1 deletion docs/_data/team.js
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ export const core = [
avatar: 'https://github.com/bluwy.png',
name: 'Bjorn Lu',
title: 'Open Source Developer',
desc: 'Vite, Astro, and Svelte core team member.',
desc: 'Building tools for fun.',
links: [
{ icon: 'github', link: 'https://github.com/bluwy' },
{ icon: 'bluesky', link: 'https://bsky.app/profile/bluwy.me' },
2 changes: 1 addition & 1 deletion docs/blog/announcing-vite2.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ Vite (French word for "fast", pronounced `/vit/`) is a new kind of build tool fo

To get a sense of how fast Vite is, check out [this video comparison](https://twitter.com/amasad/status/1355379680275128321) of booting up a React application on Repl.it using Vite vs. `create-react-app` (CRA).

If you've never heard of Vite before and would love to learn more about it, check out [the rationale behind the project](https://vite.dev/guide/why.html). If you are interested in how Vite differs from other similar tools, check out the [comparisons](https://vite.dev/guide/comparisons.html).
If you've never heard of Vite before and would love to learn more about it, check out [the rationale behind the project](https://vite.dev/guide/why.html). If you are interested in how Vite differs from other similar tools, check out the [comparisons](https://v5.vite.dev/guide/comparisons.html).

## What's New in 2.0

8 changes: 6 additions & 2 deletions docs/config/build-options.md
Original file line number Diff line number Diff line change
@@ -191,15 +191,19 @@ export default defineConfig({
- **Default:** `false`
- **Related:** [Backend Integration](/guide/backend-integration)

When set to `true`, the build will also generate a `.vite/manifest.json` file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links. When the value is a string, it will be used as the manifest file name.
Whether to generate a manifest file that contains a mapping of non-hashed asset filenames to their hashed versions, which can then be used by a server framework to render the correct asset links.

When the value is a string, it will be used as the manifest file path relative to `build.outDir`. When set to `true`, the path would be `.vite/manifest.json`.

## build.ssrManifest

- **Type:** `boolean | string`
- **Default:** `false`
- **Related:** [Server-Side Rendering](/guide/ssr)

When set to `true`, the build will also generate an SSR manifest for determining style links and asset preload directives in production. When the value is a string, it will be used as the manifest file name.
Whether to generate a SSR manifest file for determining style links and asset preload directives in production.

When the value is a string, it will be used as the manifest file path relative to `build.outDir`. When set to `true`, the path would be `.vite/ssr-manifest.json`.

## build.ssr

27 changes: 24 additions & 3 deletions docs/config/index.md
Original file line number Diff line number Diff line change
@@ -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
}
@@ -23,6 +22,12 @@ You can also explicitly specify a config file to use with the `--config` CLI opt
vite --config my-config.js
```

::: tip CONFIG LOADING
By default, Vite uses `esbuild` to bundle the config into a temporary file and load it. This may cause issues when importing TypeScript files in a monorepo. If you encounter any issues with this approach, you can specify `--configLoader runner` to use the [module runner](/guide/api-environment-runtimes.html#modulerunner) instead, which will not create a temporary config and will transform any files on the fly. Note that module runner doesn't support CJS in config files, but external CJS packages should work as usual.

Alternatively, if you're using an environment that supports TypeScript (e.g. `node --experimental-strip-types`), or if you're only writing plain JavaScript, you can specify `--configLoader native` to use the environment's native runtime to load the config file. Note that updates to modules imported by the config file are not detected and hence would not auto-restart the Vite server.
:::

## Config Intellisense

Since Vite ships with TypeScript typings, you can leverage your IDE's intellisense with jsdoc type hints:
@@ -56,7 +61,7 @@ export default {

## Conditional Config

If the config needs to conditionally determine options based on the command (`serve` or `build`), the [mode](/guide/env-and-mode) being used, if it's an SSR build (`isSsrBuild`), or is previewing the build (`isPreview`), it can export a function instead:
If the config needs to conditionally determine options based on the command (`serve` or `build`), the [mode](/guide/env-and-mode#modes) being used, if it's an SSR build (`isSsrBuild`), or is previewing the build (`isPreview`), it can export a function instead:

```js twoslash
import { defineConfig } from 'vite'
@@ -116,3 +121,19 @@ export default defineConfig(({ mode }) => {
}
})
```

## Debugging the Config File on VS Code

With the default `--configLoader bundle` behavior, Vite writes the generated temporary configuration file to the `node_modules/.vite-temp` folder and a file not found error will occur when setting breakpoint debugging in the Vite config file. To fix the issue, add the following configuration to `.vscode/settings.json`:

```json
{
"debug.javascript.terminalOptions": {
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**",
"**/node_modules/.vite-temp/**"
]
}
}
```
17 changes: 14 additions & 3 deletions docs/config/preview-options.md
Original file line number Diff line number Diff line change
@@ -19,6 +19,15 @@ See [`server.host`](./server-options#server-host) for more details.

:::

## preview.allowedHosts

- **Type:** `string | true`
- **Default:** [`server.allowedHosts`](./server-options#server-allowedhosts)

The hostnames that Vite is allowed to respond to.

See [`server.allowedHosts`](./server-options#server-allowedhosts) for more details.

## preview.port

- **Type:** `number`
@@ -51,9 +60,9 @@ Set to `true` to exit if port is already in use, instead of automatically trying
- **Type:** `https.ServerOptions`
- **Default:** [`server.https`](./server-options#server-https)

Enable TLS + HTTP/2. Note this downgrades to TLS only when the [`server.proxy` option](./server-options#server-proxy) is also used.
Enable TLS + HTTP/2.

The value can also be an [options object](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) passed to `https.createServer()`.
See [`server.https`](./server-options#server-https) for more details.

## preview.open

@@ -78,7 +87,9 @@ Uses [`http-proxy`](https://github.com/http-party/node-http-proxy). Full options
- **Type:** `boolean | CorsOptions`
- **Default:** [`server.cors`](./server-options#server-cors)

Configure CORS for the preview server. This is enabled by default and allows any origin. Pass an [options object](https://github.com/expressjs/cors#configuration-options) to fine tune the behavior or `false` to disable.
Configure CORS for the preview server.

See [`server.cors`](./server-options#server-cors) for more details.

## preview.headers

44 changes: 41 additions & 3 deletions docs/config/server-options.md
Original file line number Diff line number Diff line change
@@ -42,6 +42,37 @@ See [the WSL document](https://learn.microsoft.com/en-us/windows/wsl/networking#

:::

## server.allowedHosts

- **Type:** `string[] | true`
- **Default:** `[]`

The hostnames that Vite is allowed to respond to.
`localhost` and domains under `.localhost` and all IP addresses are allowed by default.
When using HTTPS, this check is skipped.

If a string starts with `.`, it will allow that hostname without the `.` and all subdomains under the hostname. For example, `.example.com` will allow `example.com`, `foo.example.com`, and `foo.bar.example.com`. If set to `true`, the server is allowed to respond to requests for any hosts.

::: details What hosts are safe to be added?

Hosts that you have control over which IP addresses they resolve to are safe to add to the list of allowed hosts.

For example, if you own a domain `vite.dev`, you can add `vite.dev` and `.vite.dev` to the list. If you don't own that domain and you cannot trust the owner of that domain, you should not add it.

Especially, you should never add Top-Level Domains like `.com` to the list. This is because anyone can purchase a domain like `example.com` and control the IP address it resolves to.

:::

::: danger

Setting `server.allowedHosts` to `true` allows any website to send requests to your dev server through DNS rebinding attacks, allowing them to download your source code and content. We recommend always using an explicit list of allowed hosts. See [GHSA-vg6x-rcgg-rjx6](https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6) for more details.

:::

::: details Configure via environment variable
You can set the environment variable `__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS` to add an additional allowed host.
:::

## server.port

- **Type:** `number`
@@ -59,9 +90,9 @@ Set to `true` to exit if port is already in use, instead of automatically trying

- **Type:** `https.ServerOptions`

Enable TLS + HTTP/2. Note this downgrades to TLS only when the [`server.proxy` option](#server-proxy) is also used.
Enable TLS + HTTP/2. The value is an [options object](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) passed to `https.createServer()`.

The value can also be an [options object](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener) passed to `https.createServer()`.
Note that this downgrades to TLS only when the [`server.proxy` option](#server-proxy) is also used.

A valid certificate is needed. For a basic setup, you can add [@vitejs/plugin-basic-ssl](https://github.com/vitejs/vite-plugin-basic-ssl) to the project plugins, which will automatically create and cache a self-signed certificate. But we recommend creating your own certificates.

@@ -147,8 +178,15 @@ export default defineConfig({
## server.cors

- **Type:** `boolean | CorsOptions`
- **Default:** `{ origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/ }` (allows localhost, `127.0.0.1` and `::1`)

Configure CORS for the dev server. Pass an [options object](https://github.com/expressjs/cors#configuration-options) to fine tune the behavior or `true` to allow any origin.

::: danger

Configure CORS for the dev server. This is enabled by default and allows any origin. Pass an [options object](https://github.com/expressjs/cors#configuration-options) to fine tune the behavior or `false` to disable.
Setting `server.cors` to `true` allows any website to send requests to your dev server and download your source code and content. We recommend always using an explicit list of allowed origins.

:::

## server.headers

48 changes: 47 additions & 1 deletion docs/guide/api-environment-frameworks.md
Original file line number Diff line number Diff line change
@@ -38,16 +38,62 @@ if (isRunnableDevEnvironment(server.environments.ssr)) {
```

:::warning
The `runner` is evaluated eagerly when it's accessed for the first time. Beware that Vite enables source map support when the `runner` is created by calling `process.setSourceMapsEnabled` or by overriding `Error.prepareStackTrace` if it's not available.
The `runner` is evaluated lazily only when it's accessed for the first time. Beware that Vite enables source map support when the `runner` is created by calling `process.setSourceMapsEnabled` or by overriding `Error.prepareStackTrace` if it's not available.
:::

Frameworks that communicate with their runtime via the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) can utilize the `FetchableDevEnvironment` that provides a standardized way of handling requests via the `handleRequest` method:

```ts
import {
createServer,
createFetchableDevEnvironment,
isFetchableDevEnvironment,
} from 'vite'

const server = await createServer({
server: { middlewareMode: true },
appType: 'custom',
environments: {
custom: {
dev: {
createEnvironment(name, config) {
return createFetchableDevEnvironment(name, config, {
handleRequest(request: Request): Promise<Response> | Response {
// handle Request and return a Response
},
})
},
},
},
},
})

// Any consumer of the environment API can now call `dispatchFetch`
if (isFetchableDevEnvironment(server.environments.custom)) {
const response: Response = await server.environments.custom.dispatchFetch(
new Request('/request-to-handle'),
)
}
```

:::warning
Vite validates the input and output of the `dispatchFetch` method: the request must be an instance of the global `Request` class and the response must be the instance of the global `Response` class. Vite will throw a `TypeError` if this is not the case.

Note that although the `FetchableDevEnvironment` is implemented as a class, it is considered an implementation detail by the Vite team and might change at any moment.
:::

## Default `RunnableDevEnvironment`

Given a Vite server configured in middleware mode as described by the [SSR setup guide](/guide/ssr#setting-up-the-dev-server), let's implement the SSR middleware using the environment API. Error handling is omitted.

```js
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { createServer } from 'vite'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

const server = await createServer({
server: { middlewareMode: true },
appType: 'custom',
17 changes: 5 additions & 12 deletions docs/guide/api-environment-runtimes.md
Original file line number Diff line number Diff line change
@@ -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(),
@@ -310,28 +304,28 @@ function createWorkerEnvironment(name, config, context) {
const handlerToWorkerListener = new WeakMap()

const workerHotChannel = {
send: (data) => w.postMessage(data),
send: (data) => worker.postMessage(data),
on: (event, handler) => {
if (event === 'connection') return

const listener = (value) => {
if (value.type === 'custom' && value.event === event) {
const client = {
send(payload) {
w.postMessage(payload)
worker.postMessage(payload)
},
}
handler(value.data, client)
}
}
handlerToWorkerListener.set(handler, listener)
w.on('message', listener)
worker.on('message', listener)
},
off: (event, handler) => {
if (event === 'connection') return
const listener = handlerToWorkerListener.get(handler)
if (listener) {
w.off('message', listener)
worker.off('message', listener)
handlerToWorkerListener.delete(handler)
}
},
@@ -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`, {
14 changes: 10 additions & 4 deletions docs/guide/api-hmr.md
Original file line number Diff line number Diff line change
@@ -10,7 +10,10 @@ Vite exposes its manual HMR API via the special `import.meta.hot` object:

```ts twoslash
import type { ModuleNamespace } from 'vite/types/hot.d.ts'
import type { InferCustomEventPayload } from 'vite/types/customEvent.d.ts'
import type {
CustomEventName,
InferCustomEventPayload,
} from 'vite/types/customEvent.d.ts'

// ---cut---
interface ImportMeta {
@@ -32,15 +35,18 @@ interface ViteHotContext {
prune(cb: (data: any) => void): void
invalidate(message?: string): void

on<T extends string>(
on<T extends CustomEventName>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void,
): void
off<T extends string>(
off<T extends CustomEventName>(
event: T,
cb: (payload: InferCustomEventPayload<T>) => void,
): void
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
send<T extends CustomEventName>(
event: T,
data?: InferCustomEventPayload<T>,
): void
}
```

2 changes: 1 addition & 1 deletion docs/guide/assets.md
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ document.getElementById('hero-img').style.background = `url("${imgUrl}")`

### Explicit URL Imports

Assets that are not included in the internal list or in `assetsInclude`, can be explicitly imported as a URL using the `?url` suffix. This is useful, for example, to import [Houdini Paint Worklets](https://houdini.how/usage).
Assets that are not included in the internal list or in `assetsInclude`, can be explicitly imported as a URL using the `?url` suffix. This is useful, for example, to import [Houdini Paint Worklets](https://developer.mozilla.org/en-US/docs/Web/API/CSS/paintWorklet_static).

```js twoslash
import 'vite/client'
6 changes: 6 additions & 0 deletions docs/guide/backend-integration.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,12 @@ If you need a custom integration, you can follow the steps in this guide to conf
import { defineConfig } from 'vite'
// ---cut---
export default defineConfig({
server: {
cors: {
// the origin you will be accessing via browser
origin: 'http://my-backend.example.com',
},
},
build: {
// generate .vite/manifest.json in outDir
manifest: true,
32 changes: 25 additions & 7 deletions docs/guide/build.md
Original file line number Diff line number Diff line change
@@ -4,14 +4,23 @@ When it is time to deploy your app for production, simply run the `vite build` c

## Browser Compatibility

The production bundle assumes support for modern JavaScript. By default, Vite targets browsers which support the [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta):
By default, the production bundle assumes support for modern JavaScript, such as [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta), [nullish coalescing](https://caniuse.com/mdn-javascript_operators_nullish_coalescing), and [BigInt](https://caniuse.com/bigint). The default browser support range is:

<!-- Search for the `ESBUILD_MODULES_TARGET` constant for more information -->

- Chrome >=87
- Firefox >=78
- Safari >=14
- Edge >=88

You can specify custom targets via the [`build.target` config option](/config/build-options.md#build-target), where the lowest target is `es2015`.
You can specify custom targets via the [`build.target` config option](/config/build-options.md#build-target), where the lowest target is `es2015`. If a lower target is set, Vite will still require these minimum browser support ranges as it relies on [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta):

<!-- Search for the `defaultEsbuildSupported` constant for more information -->

- Chrome >=64
- Firefox >=67
- Safari >=11.1
- Edge >=79

Note that by default, Vite only handles syntax transforms and **does not cover polyfills**. You can check out https://cdnjs.cloudflare.com/polyfill/ which automatically generates polyfill bundles based on the user's browser UserAgent string.

@@ -57,7 +66,7 @@ For example, you can specify multiple Rollup outputs with plugins that are only

## Chunking Strategy

You can configure how chunks are split using `build.rollupOptions.output.manualChunks` (see [Rollup docs](https://rollupjs.org/configuration-options/#output-manualchunks)). If you use a framework, refer to their documentation for configuring how chunks are splitted.
You can configure how chunks are split using `build.rollupOptions.output.manualChunks` (see [Rollup docs](https://rollupjs.org/configuration-options/#output-manualchunks)). If you use a framework, refer to their documentation for configuring how chunks are split.

## Load Error Handling

@@ -71,7 +80,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`:

@@ -106,9 +115,12 @@ During dev, simply navigate or link to `/nested/` - it works as expected, just l
During build, all you need to do is to specify multiple `.html` files as entry points:

```js twoslash [vite.config.js]
import { resolve } from 'path'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
build: {
rollupOptions: {
@@ -134,9 +146,12 @@ When it is time to bundle your library for distribution, use the [`build.lib` co
::: code-group
```js twoslash [vite.config.js (single entry)]
import { resolve } from 'path'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
build: {
lib: {
@@ -162,9 +177,12 @@ export default defineConfig({
```
```js twoslash [vite.config.js (multiple entries)]
import { resolve } from 'path'
import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'

const __dirname = dirname(fileURLToPath(import.meta.url))

export default defineConfig({
build: {
lib: {
140 changes: 73 additions & 67 deletions docs/guide/cli.md

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions docs/guide/comparisons.md

This file was deleted.

98 changes: 62 additions & 36 deletions docs/guide/env-and-mode.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Env Variables and Modes

## Env Variables
Vite exposes certain constants under the special `import.meta.env` object. These constants are defined as global variables during dev and statically replaced at build time to make tree-shaking effective.

## Built-in constants

Vite exposes env variables on the special **`import.meta.env`** object, which are statically replaced at build time. Some built-in variables are available in all cases:
Some built-in constants are available in all cases:

- **`import.meta.env.MODE`**: {string} the [mode](#modes) the app is running in.

@@ -14,7 +16,31 @@ Vite exposes env variables on the special **`import.meta.env`** object, which ar

- **`import.meta.env.SSR`**: {boolean} whether the app is running in the [server](./ssr.md#conditional-logic).

## `.env` Files
## Env Variables

Vite exposes env variables under `import.meta.env` object as strings automatically.

To prevent accidentally leaking env variables to the client, only variables prefixed with `VITE_` are exposed to your Vite-processed code. e.g. for the following env variables:

```[.env]
VITE_SOME_KEY=123
DB_PASSWORD=foobar
```

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

```js
console.log(import.meta.env.VITE_SOME_KEY) // "123"
console.log(import.meta.env.DB_PASSWORD) // undefined
```
If you want to customize the env variables prefix, see the [envPrefix](/config/shared-options.html#envprefix) option.
:::tip Env parsing
As shown above, `VITE_SOME_KEY` is a number but returns a string when parsed. The same would also happen for boolean env variables. Make sure to convert to the desired type when using it in your code.
:::
### `.env` Files
Vite uses [dotenv](https://github.com/motdotla/dotenv) to load additional environment variables from the following files in your [environment directory](/config/shared-options.md#envdir):
@@ -34,27 +60,7 @@ Vite will always load `.env` and `.env.local` in addition to the mode-specific `
In addition, environment variables that already exist when Vite is executed have the highest priority and will not be overwritten by `.env` files. For example, when running `VITE_SOME_KEY=123 vite build`.
`.env` files are loaded at the start of Vite. Restart the server after making changes.
:::

Loaded env variables are also exposed to your client source code via `import.meta.env` as strings.

To prevent accidentally leaking env variables to the client, only variables prefixed with `VITE_` are exposed to your Vite-processed code. e.g. for the following env variables:
```[.env]
VITE_SOME_KEY=123
DB_PASSWORD=foobar
```

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

```js
console.log(import.meta.env.VITE_SOME_KEY) // "123"
console.log(import.meta.env.DB_PASSWORD) // undefined
```
:::tip Env parsing
As shown above, `VITE_SOME_KEY` is a number but returns a string when parsed. The same would also happen for boolean env variables. Make sure to convert to the desired type when using it in your code.
:::
Also, Vite uses [dotenv-expand](https://github.com/motdotla/dotenv-expand) to expand variables written in env files out of the box. To learn more about the syntax, check out [their docs](https://github.com/motdotla/dotenv-expand#what-rules-does-the-expansion-engine-follow).
@@ -68,16 +74,32 @@ NEW_KEY2=test\$foo # test$foo
NEW_KEY3=test$KEY # test123
```
If you want to customize the env variables prefix, see the [envPrefix](/config/shared-options.html#envprefix) option.
:::warning SECURITY NOTES
- `.env.*.local` files are local-only and can contain sensitive variables. You should add `*.local` to your `.gitignore` to avoid them being checked into git.
- Since any variables exposed to your Vite source code will end up in your client bundle, `VITE_*` variables should _not_ contain any sensitive information.
:::
### IntelliSense for TypeScript
:::
::: details Expanding variables in reverse order
Vite supports expanding variables in reverse order.
For example, the `.env` below will be evaluated as `VITE_FOO=foobar`, `VITE_BAR=bar`.
```[.env]
VITE_FOO=foo${VITE_BAR}
VITE_BAR=bar
```
This does not work in shell scripts and other tools like `docker-compose`.
That said, Vite supports this behavior as this has been supported by `dotenv-expand` for a long time and other tools in JavaScript ecosystem uses older versions that supports this behavior.
To avoid interop issues, it is recommended to avoid relying on this behavior. Vite may start emitting warnings for this behavior in the future.
:::
## IntelliSense for TypeScript
By default, Vite provides type definitions for `import.meta.env` in [`vite/client.d.ts`](https://github.com/vitejs/vite/blob/main/packages/vite/client.d.ts). While you can define more custom env variables in `.env.[mode]` files, you may want to get TypeScript IntelliSense for user-defined env variables that are prefixed with `VITE_`.
@@ -86,6 +108,12 @@ To achieve this, you can create an `vite-env.d.ts` in `src` directory, then augm
```typescript [vite-env.d.ts]
/// <reference types="vite/client" />

interface ViteTypeOptions {
// By adding this line, you can make the type of ImportMetaEnv strict
// to disallow unknown keys.
// strictImportMetaEnv: unknown
}

interface ImportMetaEnv {
readonly VITE_APP_TITLE: string
// more env variables...
@@ -107,11 +135,12 @@ If your code relies on types from browser environments such as [DOM](https://git
:::warning Imports will break type augmentation
If the `ImportMetaEnv` augmentation does not work, make sure you do not have any `import` statements in `vite-env.d.ts`. See the [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/2/modules.html#how-javascript-modules-are-defined) for more information.
:::
## HTML Env Replacement
## HTML Constant Replacement
Vite also supports replacing env variables in HTML files. Any properties in `import.meta.env` can be used in HTML files with a special `%ENV_NAME%` syntax:
Vite also supports replacing constants in HTML files. Any properties in `import.meta.env` can be used in HTML files with a special `%CONST_NAME%` syntax:
```html
<h1>Vite is running in %MODE%</h1>
@@ -128,8 +157,7 @@ By default, the dev server (`dev` command) runs in `development` mode and the `b
This means when running `vite build`, it will load the env variables from `.env.production` if there is one:
```
# .env.production
```[.env.production]
VITE_APP_TITLE=My App
```
@@ -143,19 +171,17 @@ vite build --mode staging
And create a `.env.staging` file:
```
# .env.staging
```[.env.staging]
VITE_APP_TITLE=My App (staging)
```
As `vite build` runs a production build by default, you can also change this and run a development build by using a different mode and `.env` file configuration:
```
# .env.testing
```[.env.testing]
NODE_ENV=development
```
## NODE_ENV and Modes
### NODE_ENV and Modes
It's important to note that `NODE_ENV` (`process.env.NODE_ENV`) and modes are two different concepts. Here's how different commands affect the `NODE_ENV` and mode:
81 changes: 40 additions & 41 deletions docs/guide/features.md
Original file line number Diff line number Diff line change
@@ -71,18 +71,13 @@ If a dependency doesn't work well with `"isolatedModules": true`. You can use `"

- [TypeScript documentation](https://www.typescriptlang.org/tsconfig#useDefineForClassFields)

Starting from Vite 2.5.0, the default value will be `true` if the TypeScript target is `ESNext` or `ES2022` or newer. It is consistent with the [behavior of `tsc` 4.3.2 and later](https://github.com/microsoft/TypeScript/pull/42663). It is also the standard ECMAScript runtime behavior.

The default value will be `true` if the TypeScript target is `ES2022` or newer including `ESNext`. It is consistent with the [behavior of TypeScript 4.3.2+](https://github.com/microsoft/TypeScript/pull/42663).
Other TypeScript targets will default to `false`.

But it may be counter-intuitive for those coming from other programming languages or older versions of TypeScript.
You can read more about the transition in the [TypeScript 3.7 release notes](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier).
`true` is the standard ECMAScript runtime behavior.

If you are using a library that heavily relies on class fields, please be careful about the library's intended usage of it.

Most libraries expect `"useDefineForClassFields": true`, such as [MobX](https://mobx.js.org/installation.html#use-spec-compliant-transpilation-for-class-properties).

But a few libraries haven't transitioned to this new default yet, including [`lit-element`](https://github.com/lit/lit-element/issues/1030). Please explicitly set `useDefineForClassFields` to `false` in these cases.
While most libraries expect `"useDefineForClassFields": true`, you can explicitly set `useDefineForClassFields` to `false` if your library doesn't support it.

#### `target`

@@ -124,20 +119,26 @@ Vite's default types are for its Node.js API. To shim the environment of client
/// <reference types="vite/client" />
```

::: details Using `compilerOptions.types`

Alternatively, you can add `vite/client` to `compilerOptions.types` inside `tsconfig.json`:

```json [tsconfig.json]
{
"compilerOptions": {
"types": ["vite/client"]
"types": ["vite/client", "some-other-global-lib"]
}
}
```

This will provide the following type shims:
Note that if [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig#types) is specified, only these packages will be included in the global scope (instead of all visible ”@types” packages).

:::

`vite/client` provides the following type shims:

- Asset imports (e.g. importing an `.svg` file)
- Types for the Vite-injected [env variables](./env-and-mode#env-variables) on `import.meta.env`
- Types for the Vite-injected [constants](./env-and-mode#env-variables) on `import.meta.env`
- Types for the [HMR API](./api-hmr) on `import.meta.hot`

::: tip
@@ -204,22 +205,24 @@ Assets referenced by HTML elements such as `<script type="module" src>` and `<li

To opt-out of HTML processing on certain elements, you can add the `vite-ignore` attribute on the element, which can be useful when referencing external assets or CDN.

## Vue
## Frameworks

All modern frameworks maintain integrations with Vite. Most framework plugins are maintained by each framework team, with the exception of the official Vue and React Vite plugins that are maintained in the vite org:

Vite provides first-class Vue support:
- Vue support via [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
- Vue JSX support via [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
- React support via [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react)
- React using SWC support via [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc)

- Vue 3 SFC support via [@vitejs/plugin-vue](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue)
- Vue 3 JSX support via [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx)
- Vue 2.7 SFC support via [@vitejs/plugin-vue2](https://github.com/vitejs/vite-plugin-vue2)
- Vue 2.7 JSX support via [@vitejs/plugin-vue2-jsx](https://github.com/vitejs/vite-plugin-vue2-jsx)
Check out the [Plugins Guide](https://vite.dev/plugins) for more information.

## JSX

`.jsx` and `.tsx` files are also supported out of the box. JSX transpilation is also handled via [esbuild](https://esbuild.github.io).

Vue users should use the official [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) plugin, which provides Vue 3 specific features including HMR, global component resolving, directives and slots.
Your framework of choice will already configure JSX out of the box (for example, Vue users should use the official [@vitejs/plugin-vue-jsx](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue-jsx) plugin, which provides Vue 3 specific features including HMR, global component resolving, directives and slots).

If using JSX without React or Vue, custom `jsxFactory` and `jsxFragment` can be configured using the [`esbuild` option](/config/shared-options.md#esbuild). For example for Preact:
If using JSX with your own framework, custom `jsxFactory` and `jsxFragment` can be configured using the [`esbuild` option](/config/shared-options.md#esbuild). For example, the Preact plugin would use:

```js twoslash [vite.config.js]
import { defineConfig } from 'vite'
@@ -345,10 +348,6 @@ To configure CSS Modules, you'll use [`css.lightningcss.cssModules`](https://lig

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#build-cssminify).

::: 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:
@@ -420,8 +419,8 @@ The above will be transformed into the following:
```js
// code produced by vite
const modules = {
'./dir/foo.js': () => import('./dir/foo.js'),
'./dir/bar.js': () => import('./dir/bar.js'),
'./dir/foo.js': () => import('./dir/foo.js'),
}
```

@@ -447,11 +446,11 @@ The above will be transformed into the following:

```js
// code produced by vite
import * as __glob__0_0 from './dir/foo.js'
import * as __glob__0_1 from './dir/bar.js'
import * as __vite_glob_0_0 from './dir/bar.js'
import * as __vite_glob_0_1 from './dir/foo.js'
const modules = {
'./dir/foo.js': __glob__0_0,
'./dir/bar.js': __glob__0_1,
'./dir/bar.js': __vite_glob_0_0,
'./dir/foo.js': __vite_glob_0_1,
}
```

@@ -495,8 +494,8 @@ const modules = import.meta.glob('./dir/*.js', { import: 'setup' })
```ts
// code produced by vite
const modules = {
'./dir/foo.js': () => import('./dir/foo.js').then((m) => m.setup),
'./dir/bar.js': () => import('./dir/bar.js').then((m) => m.setup),
'./dir/foo.js': () => import('./dir/foo.js').then((m) => m.setup),
}
```

@@ -513,11 +512,11 @@ const modules = import.meta.glob('./dir/*.js', {

```ts
// code produced by vite:
import { setup as __glob__0_0 } from './dir/foo.js'
import { setup as __glob__0_1 } from './dir/bar.js'
import { setup as __vite_glob_0_0 } from './dir/bar.js'
import { setup as __vite_glob_0_1 } from './dir/foo.js'
const modules = {
'./dir/foo.js': __glob__0_0,
'./dir/bar.js': __glob__0_1,
'./dir/bar.js': __vite_glob_0_0,
'./dir/foo.js': __vite_glob_0_1,
}
```

@@ -534,11 +533,11 @@ const modules = import.meta.glob('./dir/*.js', {

```ts
// code produced by vite:
import __glob__0_0 from './dir/foo.js'
import __glob__0_1 from './dir/bar.js'
import { default as __vite_glob_0_0 } from './dir/bar.js'
import { default as __vite_glob_0_1 } from './dir/foo.js'
const modules = {
'./dir/foo.js': __glob__0_0,
'./dir/bar.js': __glob__0_1,
'./dir/bar.js': __vite_glob_0_0,
'./dir/foo.js': __vite_glob_0_1,
}
```

@@ -562,12 +561,12 @@ const moduleUrls = import.meta.glob('./dir/*.svg', {
```ts
// code produced by vite:
const moduleStrings = {
'./dir/foo.svg': () => import('./dir/foo.js?raw').then((m) => m['default']),
'./dir/bar.svg': () => import('./dir/bar.js?raw').then((m) => m['default']),
'./dir/bar.svg': () => import('./dir/bar.svg?raw').then((m) => m['default']),
'./dir/foo.svg': () => import('./dir/foo.svg?raw').then((m) => m['default']),
}
const moduleUrls = {
'./dir/foo.svg': () => import('./dir/foo.js?url').then((m) => m['default']),
'./dir/bar.svg': () => import('./dir/bar.js?url').then((m) => m['default']),
'./dir/bar.svg': () => import('./dir/bar.svg?url').then((m) => m['default']),
'./dir/foo.svg': () => import('./dir/foo.svg?url').then((m) => m['default']),
}
```

32 changes: 30 additions & 2 deletions docs/guide/index.md
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ You can learn more about the rationale behind the project in the [Why Vite](./wh

During development, Vite sets [`esnext` as the transform target](https://esbuild.github.io/api/#target), because we assume a modern browser is used and it supports all of the latest JavaScript and CSS features. This prevents syntax lowering, letting Vite serve modules as close as possible to the original source code.

For the production build, by default Vite targets browsers that support [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), and [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy). See the [Building for Production](./build) section for more details.
For the production build, by default Vite targets browsers that support modern JavaScript, such as [native ES Modules](https://caniuse.com/es6-module), [native ESM dynamic import](https://caniuse.com/es6-module-dynamic-import), [`import.meta`](https://caniuse.com/mdn-javascript_operators_import_meta), [nullish coalescing](https://caniuse.com/mdn-javascript_operators_nullish_coalescing), and [BigInt](https://caniuse.com/bigint). Legacy browsers can be supported via the official [@vitejs/plugin-legacy](https://github.com/vitejs/vite/tree/main/packages/plugin-legacy). See the [Building for Production](./build) section for more details.

## Trying Vite Online

@@ -202,7 +202,31 @@ Learn more about the [Command Line Interface](./cli.md)

## Using Unreleased Commits

If you can't wait for a new release to test the latest features, you will need to clone the [vite repo](https://github.com/vitejs/vite) to your local machine and then build and link it yourself ([pnpm](https://pnpm.io/) is required):
If you can't wait for a new release to test the latest features, you can install a specific commit of Vite with https://pkg.pr.new:

::: code-group

```bash [npm]
$ npm install -D https://pkg.pr.new/vite@SHA
```

```bash [Yarn]
$ yarn add -D https://pkg.pr.new/vite@SHA
```

```bash [pnpm]
$ pnpm add -D https://pkg.pr.new/vite@SHA
```

```bash [Bun]
$ bun add -D https://pkg.pr.new/vite@SHA
```

:::

Replace `SHA` with any of [Vite's commit SHAs](https://github.com/vitejs/vite/commits/main/). Note that only commits within the last month will work, as older commit releases are purged.

Alternatively, you can also clone the [vite repo](https://github.com/vitejs/vite) to your local machine and then build and link it yourself ([pnpm](https://pnpm.io/) is required):

```bash
git clone https://github.com/vitejs/vite.git
@@ -215,6 +239,10 @@ pnpm link --global # use your preferred package manager for this step

Then go to your Vite based project and run `pnpm link --global vite` (or the package manager that you used to link `vite` globally). Now restart the development server to ride on the bleeding edge!

::: tip Dependencies using Vite
To replace the Vite version used by dependencies transitively, you should use [npm overrides](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#overrides) or [pnpm overrides](https://pnpm.io/package_json#pnpmoverrides).
:::

## Community

If you have questions or need help, reach out to the community at [Discord](https://chat.vite.dev) and [GitHub Discussions](https://github.com/vitejs/vite/discussions).
4 changes: 2 additions & 2 deletions docs/guide/migration.md
Original file line number Diff line number Diff line change
@@ -99,8 +99,8 @@ There are other breaking changes which only affect few users.
- This PR not only introduces a breaking change mentioned above as "Default value for `resolve.conditions`", but also makes `resolve.mainFields` to not be used for no-externalized dependencies in SSR. If you were using `resolve.mainFields` and want to apply that to no-externalized dependencies in SSR, you can use [`ssr.resolve.mainFields`](/config/ssr-options#ssr-resolve-mainfields).
- [[#18493] refactor!: remove fs.cachedChecks option](https://github.com/vitejs/vite/pull/18493)
- This opt-in optimization was removed due to edge cases when writing a file in a cached folder and immediately importing it.
- [[#18697] fix(deps)!: update dependency dotenv-expand to v12](https://github.com/vitejs/vite/pull/18697)
- Variables used in interpolation should be declared before the interpolation now. For more details, see [the `dotenv-expand` changelog](https://github.com/motdotla/dotenv-expand/blob/v12.0.1/CHANGELOG.md#1200-2024-11-16).
- ~~[[#18697] fix(deps)!: update dependency dotenv-expand to v12](https://github.com/vitejs/vite/pull/18697)~~
- ~~Variables used in interpolation should be declared before the interpolation now. For more details, see [the `dotenv-expand` changelog](https://github.com/motdotla/dotenv-expand/blob/v12.0.1/CHANGELOG.md#1200-2024-11-16).~~ This breaking change was reverted in v6.1.0.
- [[#16471] feat: v6 - Environment API](https://github.com/vitejs/vite/pull/16471)

- Updates to an SSR-only module no longer triggers a full page reload in the client. To return to the previous behaviour, a custom Vite plugin can be used:
1 change: 1 addition & 0 deletions docs/guide/performance.md
Original file line number Diff line number Diff line change
@@ -122,5 +122,6 @@ Examples of using native tooling:

Using native tooling often brings larger installation size and as so is not the default when starting a new Vite project. But it may be worth the cost for larger applications.

- Use [Rolldown instead of Rollup and esbuild](./rolldown) for faster builds and a more aligned experience between dev and build.
- Try out the experimental support for [LightningCSS](https://github.com/vitejs/vite/discussions/13835)
- Use [`@vitejs/plugin-react-swc`](https://github.com/vitejs/vite-plugin-react-swc) in place of `@vitejs/plugin-react`.
2 changes: 1 addition & 1 deletion docs/guide/philosophy.md
Original file line number Diff line number Diff line change
@@ -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).

93 changes: 93 additions & 0 deletions docs/guide/rolldown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Rolldown Integration

Vite is planning to integrate [Rolldown](https://rolldown.rs), a Rust-powered JavaScript bundler, to improve build performance and capabilities.

## What is Rolldown?

Rolldown is a modern, high-performance JavaScript bundler written in Rust. It's designed as a drop-in replacement for Rollup, aiming to provide significant performance improvements while maintaining compatibility with the existing ecosystem.

Rolldown focuses on three key principles:

- **Speed**: Built with Rust for maximum performance
- **Compatibility**: Works with existing Rollup plugins
- **Developer Experience**: Familiar API for Rollup users

## Why Vite is Migrating to Rolldown

1. **Unification**: Vite currently uses esbuild for dependency pre-bundling and Rollup for production builds. Rolldown aims to unify these into a single, high-performance bundler that can be used for both purposes, reducing complexity.

2. **Performance**: Rolldown's Rust-based implementation offers significant performance improvements over JavaScript-based bundlers. While specific benchmarks may vary by project size and complexity, early tests show promising speed increases compared to Rollup.

For additional insights on the motivations behind Rolldown, see the [reasons why Rolldown is being built](https://rolldown.rs/guide/#why-rolldown).

## Benefits of Trying `rolldown-vite`

- Experience significantly faster build times, especially for larger projects
- Provide valuable feedback to help shape the future of Vite's bundling experience
- Prepare your projects for the eventual official Rolldown integration

## How to Try Rolldown

The rolldown-powered version of Vite is currently available as a separate package called `rolldown-vite`. You can try it by adding package overrides to your `package.json`:

:::code-group

```json [npm]
{
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
```

```json [Yarn]
{
"resolutions": {
"vite": "npm:rolldown-vite@latest"
}
}
```

```json [pnpm]
{
"pnpm": {
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
}
```

```json [Bun]
{
"overrides": {
"vite": "npm:rolldown-vite@latest"
}
}
```

:::

After adding these overrides, reinstall your dependencies and start your development server or build your project as usual. No further configuration changes are required.

## Known Limitations

While Rolldown aims to be a drop-in replacement for Rollup, there are features that are still being implemented and minor intentional behavior differences. For a comprehensive list, please refer to [this GitHub PR](https://github.com/vitejs/rolldown-vite/pull/84#issue-2903144667) which is regularly updated.

## Reporting Issues

Since this is an experimental integration, you may encounter issues. If you do, please report them in the [`vitejs/rolldown-vite`](https://github.com/vitejs/rolldown-vite) repository, **not the main Vite repository**.

When [reporting issues](https://github.com/vitejs/rolldown-vite/issues/new), please follow the issue template and provide:

- A minimal reproduction of the issue
- Your environment details (OS, Node version, package manager)
- Any relevant error messages or logs

For real-time discussions and troubleshooting, make sure to join the [Rolldown Discord](https://chat.rolldown.rs/).

## Future Plans

The `rolldown-vite` package is a temporary solution to gather feedback and stabilize the Rolldown integration. In the future, this functionality will be merged back into the main Vite repository.

We encourage you to try out `rolldown-vite` and contribute to its development through feedback and issue reports.
6 changes: 1 addition & 5 deletions docs/guide/ssr.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Server-Side Rendering
# Server-Side Rendering (SSR)

:::tip Note
SSR specifically refers to front-end frameworks (for example React, Preact, Vue, and Svelte) that support running the same application in Node.js, pre-rendering it to HTML, and finally hydrating it on the client. If you are looking for integration with traditional server-side frameworks, check out the [Backend Integration guide](./backend-integration) instead.
@@ -12,10 +12,6 @@ This is a low-level API meant for library and framework authors. If your goal is
Currently, Vite is working on an improved SSR API with the [Environment API](https://github.com/vitejs/vite/discussions/16358). Check out the link for more details.
:::

:::tip Help
If you have questions, the community is usually helpful at [Vite Discord's #ssr channel](https://discord.gg/PkbxgzPhJv).
:::

## Example Projects

Vite provides built-in support for server-side rendering (SSR). [`create-vite-extra`](https://github.com/bluwy/create-vite-extra) contains example SSR setups you can use as references for this guide:
13 changes: 12 additions & 1 deletion docs/guide/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -102,6 +102,9 @@ For Ubuntu Linux, you may need to add the line `* - nofile 65536` to the file `/

Note that these settings persist but a **restart is required**.

Alternatively, if the server is running inside a VS Code devcontainer, the request may appear to be stalled. To fix this issue, see
[Dev Containers / VS Code Port Forwarding](#dev-containers-vs-code-port-forwarding).

### Network requests stop loading

When using a self-signed SSL certificate, Chrome ignores all caching directives and reloads the content. Vite relies on these caching directives.
@@ -130,6 +133,14 @@ This is because Node.js limits request header size to mitigate [CVE-2018-12121](

To avoid this, try to reduce your request header size. For example, if the cookie is long, delete it. Or you can use [`--max-http-header-size`](https://nodejs.org/api/cli.html#--max-http-header-sizesize) to change max header size.

### Dev Containers / VS Code Port Forwarding

If you are using a Dev Container or port forwarding feature in VS Code, you may need to set the [`server.host`](/config/server-options.md#server-host) option to `127.0.0.1` in the config to make it work.

This is because [the port forwarding feature in VS Code does not support IPv6](https://github.com/microsoft/vscode-remote-release/issues/7029).

See [#16522](https://github.com/vitejs/vite/issues/16522) for more details.

## HMR

### Vite detects a file change but the HMR is not working
@@ -172,7 +183,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:

12 changes: 8 additions & 4 deletions docs/guide/why.md
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ Vite improves the dev server start time by first dividing the modules in an appl

- **Dependencies** are mostly plain JavaScript that do not change often during development. Some large dependencies (e.g. component libraries with hundreds of modules) are also quite expensive to process. Dependencies may also be shipped in various module formats (e.g. ESM or CommonJS).

Vite [pre-bundles dependencies](./dep-pre-bundling) using [esbuild](https://esbuild.github.io/). esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.
Vite [pre-bundles dependencies](./dep-pre-bundling.md) using [esbuild](https://esbuild.github.io/). esbuild is written in Go and pre-bundles dependencies 10-100x faster than JavaScript-based bundlers.

- **Source code** often contains non-plain JavaScript that needs transforming (e.g. JSX, CSS or Vue/Svelte components), and will be edited very often. Also, not all source code needs to be loaded at the same time (e.g. with route-based code-splitting).

@@ -47,7 +47,7 @@ Once you experience how fast Vite is, we highly doubt you'd be willing to put up

Even though native ESM is now widely supported, shipping unbundled ESM in production is still inefficient (even with HTTP/2) due to the additional network round trips caused by nested imports. To get the optimal loading performance in production, it is still better to bundle your code with tree-shaking, lazy-loading and common chunk splitting (for better caching).

Ensuring optimal output and behavioral consistency between the dev server and the production build isn't easy. This is why Vite ships with a pre-configured [build command](./build) that bakes in many [performance optimizations](./features#build-optimizations) out of the box.
Ensuring optimal output and behavioral consistency between the dev server and the production build isn't easy. This is why Vite ships with a pre-configured [build command](./build.md) that bakes in many [performance optimizations](./features.md#build-optimizations) out of the box.

## Why Not Bundle with esbuild?

@@ -57,6 +57,10 @@ Vite's current plugin API isn't compatible with using `esbuild` as a bundler. In

Rollup has also been working on performance improvements, [switching its parser to SWC in v4](https://github.com/rollup/rollup/pull/5073). And there is an ongoing effort to build a Rust-port of Rollup called Rolldown. Once Rolldown is ready, it could replace both Rollup and esbuild in Vite, improving build performance significantly and removing inconsistencies between development and build. You can watch [Evan You's ViteConf 2023 keynote for more details](https://youtu.be/hrdwQHoAp0M).

## How is Vite Different from X?
## How Vite Relates to Other Unbundled Build Tools?

You can check out the [Comparisons](./comparisons) section for more details on how Vite differs from other similar tools.
[WMR](https://github.com/preactjs/wmr) by the Preact team looked to provide a similar feature set. Vite's universal Rollup plugin API for dev and build was inspired by it. WMR is no longer maintained. The Preact team now recommends Vite with [@preactjs/preset-vite](https://github.com/preactjs/preset-vite).

[Snowpack](https://www.snowpack.dev/) was also a no-bundle native ESM dev server, very similar in scope to Vite. Vite's dependency pre-bundling is also inspired by Snowpack v1 (now [`esinstall`](https://github.com/snowpackjs/snowpack/tree/main/esinstall)). Snowpack is no longer being maintained. The Snowpack team is now working on [Astro](https://astro.build/), a static site builder powered by Vite.

[@web/dev-server](https://modern-web.dev/docs/dev-server/overview/) (previously `es-dev-server`) is a great project and Vite 1.0's Koa-based server setup was inspired by it. The `@web` umbrella project is actively maintained and contains many other excellent tools that may benefit Vite users as well.
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -8,11 +8,11 @@
"docs-serve": "vitepress serve"
},
"devDependencies": {
"@shikijs/vitepress-twoslash": "^1.24.0",
"@shikijs/vitepress-twoslash": "^2.5.0",
"@types/express": "^4.17.21",
"feed": "^4.2.2",
"vitepress": "^1.5.0",
"vitepress-plugin-group-icons": "^1.3.1",
"vitepress": "^1.6.3",
"vitepress-plugin-group-icons": "^1.3.7",
"vue": "^3.5.13"
}
}
10 changes: 6 additions & 4 deletions docs/public/_redirects
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# temporary, we'll flip this around some day
https://vitejs.dev/* https://vite.dev/:splat 301!

/guide/api-vite-runtime /guide/api-environment 302
/guide/api-vite-runtime.html /guide/api-environment 302
/guide/api-vite-environment /guide/api-environment 302
/guide/api-vite-environment.html /guide/api-environment 302
/guide/api-vite-runtime /guide/api-environment 301
/guide/api-vite-runtime.html /guide/api-environment 301
/guide/api-vite-environment /guide/api-environment 301
/guide/api-vite-environment.html /guide/api-environment 301
/guide/comparisons /guide/why#how-vite-relates-to-other-unbundled-build-tools 301
/guide/comparisons.html /guide/why#how-vite-relates-to-other-unbundled-build-tools 301
22 changes: 12 additions & 10 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ import tseslint from 'typescript-eslint'
import globals from 'globals'

const require = createRequire(import.meta.url)
const pkg = require('./package.json')
const pkgVite = require('./packages/vite/package.json')

// Some rules work better with typechecking enabled, but as enabling it is slow,
@@ -51,6 +50,11 @@ export default tseslint.config(
...globals.node,
},
},
settings: {
node: {
version: '^18.0.0 || ^20.0.0 || >=22.0.0',
},
},
plugins: {
n: pluginN,
'import-x': pluginImportX,
@@ -59,7 +63,13 @@ export default tseslint.config(
'n/no-exports-assign': 'error',
'n/no-unpublished-bin': 'error',
'n/no-unsupported-features/es-builtins': 'error',
'n/no-unsupported-features/node-builtins': 'error',
'n/no-unsupported-features/node-builtins': [
'error',
{
// TODO: remove this when we don't support Node 18 anymore
ignores: ['Response', 'Request', 'fetch'],
},
],
'n/process-exit-as-throw': 'error',
'n/hashbang': 'error',

@@ -213,17 +223,9 @@ export default tseslint.config(
name: 'playground/test',
files: ['playground/**/__tests__/**/*.?([cm])[jt]s?(x)'],
rules: {
// engine field doesn't exist in playgrounds
'n/no-unsupported-features/es-builtins': [
'error',
{
version: pkg.engines.node,
},
],
'n/no-unsupported-features/node-builtins': [
'error',
{
version: pkg.engines.node,
// ideally we would like to allow all experimental features
// https://github.com/eslint-community/eslint-plugin-n/issues/199
ignores: ['fetch'],
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build.environment]
NODE_VERSION = "20"
NODE_VERSION = "22"
# don't need playwright for docs build
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1"
[build]
64 changes: 39 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -40,43 +40,43 @@
"ci-docs": "pnpm build && pnpm docs-build"
},
"devDependencies": {
"@eslint/js": "^9.16.0",
"@eslint/js": "^9.22.0",
"@type-challenges/utils": "^0.1.1",
"@types/babel__core": "^7.20.5",
"@types/babel__preset-env": "^7.9.7",
"@types/babel__preset-env": "^7.10.0",
"@types/convert-source-map": "^2.0.3",
"@types/cross-spawn": "^6.0.6",
"@types/debug": "^4.1.12",
"@types/estree": "^1.0.6",
"@types/etag": "^1.8.3",
"@types/less": "^3.0.7",
"@types/node": "^22.10.1",
"@types/picomatch": "^3.0.1",
"@types/less": "^3.0.8",
"@types/node": "^22.13.6",
"@types/picomatch": "^3.0.2",
"@types/stylus": "^0.48.43",
"@types/ws": "^8.5.13",
"@vitejs/release-scripts": "^1.3.2",
"@types/ws": "^8.18.0",
"@vitejs/release-scripts": "^1.3.3",
"conventional-changelog-cli": "^5.0.0",
"eslint": "^9.16.0",
"eslint-plugin-import-x": "^4.5.0",
"eslint-plugin-n": "^17.14.0",
"eslint": "^9.22.0",
"eslint-plugin-import-x": "^4.8.0",
"eslint-plugin-n": "^17.16.2",
"eslint-plugin-regexp": "^2.7.0",
"execa": "^9.5.2",
"globals": "^15.13.0",
"gsap": "^3.12.5",
"lint-staged": "^15.2.10",
"globals": "^16.0.0",
"gsap": "^3.12.7",
"lint-staged": "^15.5.0",
"picocolors": "^1.1.1",
"playwright-chromium": "^1.49.0",
"playwright-chromium": "^1.50.1",
"premove": "^4.0.0",
"prettier": "3.4.2",
"rollup": "^4.23.0",
"rollup-plugin-esbuild": "^6.1.1",
"prettier": "3.5.3",
"rollup": "^4.34.9",
"rollup-plugin-esbuild": "^6.2.1",
"simple-git-hooks": "^2.11.1",
"tslib": "^2.8.1",
"tsx": "^4.19.2",
"typescript": "~5.6.2",
"typescript-eslint": "^8.17.0",
"tsx": "^4.19.3",
"typescript": "~5.7.2",
"typescript-eslint": "^8.26.1",
"vite": "workspace:*",
"vitest": "^2.1.8"
"vitest": "^3.0.8"
},
"simple-git-hooks": {
"pre-commit": "pnpm exec lint-staged --concurrent false"
@@ -95,15 +95,17 @@
"eslint --cache --fix"
]
},
"packageManager": "pnpm@9.15.0",
"packageManager": "pnpm@10.6.3",
"pnpm": {
"overrides": {
"vite": "workspace:*"
},
"patchedDependencies": {
"http-proxy@1.18.1": "patches/http-proxy@1.18.1.patch",
"sirv@3.0.0": "patches/sirv@3.0.0.patch",
"chokidar@3.6.0": "patches/chokidar@3.6.0.patch"
"sirv@3.0.1": "patches/sirv@3.0.1.patch",
"chokidar@3.6.0": "patches/chokidar@3.6.0.patch",
"dotenv-expand@12.0.1": "patches/dotenv-expand@12.0.1.patch",
"@clack/core@0.4.1": "patches/@clack__core@0.4.1.patch"
},
"peerDependencyRules": {
"allowedVersions": {
@@ -126,7 +128,19 @@
}
}
}
}
},
"ignoredBuiltDependencies": [
"core-js",
"es5-ext"
],
"onlyBuiltDependencies": [
"@parcel/watcher",
"bcrypt",
"esbuild",
"playwright-chromium",
"simple-git-hooks",
"workerd"
]
},
"stackblitz": {
"startCommand": "pnpm --filter='./packages/vite' run dev"
59 changes: 59 additions & 0 deletions packages/create-vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,62 @@
## <small>6.3.1 (2025-02-27)</small>

* fix(create-vite): make custom command visible (#19519) ([5ea9a42](https://github.com/vitejs/vite/commit/5ea9a422c5a000c6a3183c617d6c853cdc4a5151)), closes [#19519](https://github.com/vitejs/vite/issues/19519)
* fix(create-vite): remove eslint-plugin-react (#19514) ([c0e3dba](https://github.com/vitejs/vite/commit/c0e3dba3108e479ab839205cfb046db327bdaf43)), closes [#19514](https://github.com/vitejs/vite/issues/19514)
* docs(create-vite): recommend eslint-react for linting (#19524) ([e912080](https://github.com/vitejs/vite/commit/e9120805df4dcf202caa65f15edc7d94fb521a63)), closes [#19524](https://github.com/vitejs/vite/issues/19524)
* chore: remove prompts alias (#19507) ([276c1d3](https://github.com/vitejs/vite/commit/276c1d3b4761c436dc668e76decb9cf20cb25ab9)), closes [#19507](https://github.com/vitejs/vite/issues/19507)



## 6.3.0 (2025-02-25)

* feat(create-vite): use `@clack/prompts` (#19445) ([5dae6c1](https://github.com/vitejs/vite/commit/5dae6c17da2ef135c2864500db2c8f3e2cf2b3db)), closes [#19445](https://github.com/vitejs/vite/issues/19445)



## <small>6.2.1 (2025-02-25)</small>

* fix(deps): update all non-major dependencies (#19392) ([60456a5](https://github.com/vitejs/vite/commit/60456a54fe90872dbd4bed332ecbd85bc88deb92)), closes [#19392](https://github.com/vitejs/vite/issues/19392)
* fix(deps): update all non-major dependencies (#19440) ([ccac73d](https://github.com/vitejs/vite/commit/ccac73d9d0e92c7232f09207d1d6b893e823ed8e)), closes [#19440](https://github.com/vitejs/vite/issues/19440)
* fix(deps): update all non-major dependencies (#19501) ([c94c9e0](https://github.com/vitejs/vite/commit/c94c9e052127cf4796374de1d698ec60b2973dfa)), closes [#19501](https://github.com/vitejs/vite/issues/19501)
* chore(create-vite): remove font family `Inter` (#19474) ([4bcd79a](https://github.com/vitejs/vite/commit/4bcd79a0b38c968825494da1a48f3f91fbc0fbf5)), closes [#19474](https://github.com/vitejs/vite/issues/19474)
* chore(create-vite): update `@vitejs/plugin-react-swc` version (#19384) ([39fab6d](https://github.com/vitejs/vite/commit/39fab6db204ea88ffdb346ee98d8abe0ff5d685f)), closes [#19384](https://github.com/vitejs/vite/issues/19384)
* ci: update react-swc plugin version in create-vite by renovate (#19394) ([0f058a9](https://github.com/vitejs/vite/commit/0f058a989f974d6f012539122f0580e37c2e9852)), closes [#19394](https://github.com/vitejs/vite/issues/19394)



## 6.2.0 (2025-02-05)

* fix(deps): update all non-major dependencies (#19098) ([8639538](https://github.com/vitejs/vite/commit/8639538e6498d1109da583ad942c1472098b5919)), closes [#19098](https://github.com/vitejs/vite/issues/19098)
* fix(deps): update all non-major dependencies (#19190) ([f2c07db](https://github.com/vitejs/vite/commit/f2c07dbfc874b46f6e09bb04996d0514663e4544)), closes [#19190](https://github.com/vitejs/vite/issues/19190)
* fix(deps): update all non-major dependencies (#19296) ([2bea7ce](https://github.com/vitejs/vite/commit/2bea7cec4b7fddbd5f2fb6090a7eaf5ae7ca0f1b)), closes [#19296](https://github.com/vitejs/vite/issues/19296)
* fix(deps): update all non-major dependencies (#19341) ([a2b2fad](https://github.com/vitejs/vite/commit/a2b2fad6adb781d3fb163a7e2ce4670d56d60748)), closes [#19341](https://github.com/vitejs/vite/issues/19341)
* fix(deps): update react monorepo to v19 (major) (#18917) ([93d5443](https://github.com/vitejs/vite/commit/93d54439784da0c0a995e50dcfcc081ce4da0121)), closes [#18917](https://github.com/vitejs/vite/issues/18917)
* feat(create-vite): add hint for external CLIs (#19157) ([b9a4cc6](https://github.com/vitejs/vite/commit/b9a4cc6b2875555b621f23ae5457fa37f31e2e24)), closes [#19157](https://github.com/vitejs/vite/issues/19157)
* feat(create-vite): official starters options naming (#19163) ([1992f68](https://github.com/vitejs/vite/commit/1992f681fc7662780f2f2fa4fdb0865a8a54deff)), closes [#19163](https://github.com/vitejs/vite/issues/19163)
* chore: bump TypeScript to ~5.7.2 (#19056) ([1acea1f](https://github.com/vitejs/vite/commit/1acea1f7c42e43209a6ea0aa99441f143ee15018)), closes [#19056](https://github.com/vitejs/vite/issues/19056)



## <small>6.1.1 (2024-12-24)</small>

* fix(create-vite): svelte-ts typecheck command (#19014) ([ac32968](https://github.com/vitejs/vite/commit/ac329685bba229e1ff43e3d96324f817d48abe48)), closes [#19014](https://github.com/vitejs/vite/issues/19014)
* fix(deps): update all non-major dependencies (#19045) ([b442d12](https://github.com/vitejs/vite/commit/b442d12c97357697be9341b7abebd78382a3d93d)), closes [#19045](https://github.com/vitejs/vite/issues/19045)
* refactor(create-vite): remove tslib from svelte-ts template (#19015) ([9066049](https://github.com/vitejs/vite/commit/9066049216b41ac8c6b9177539647d50d3498f1f)), closes [#19015](https://github.com/vitejs/vite/issues/19015)



## 6.1.0 (2024-12-19)

* feat(create-vite): align tsconfigs in svelte-ts template with others (#18995) ([b48b98c](https://github.com/vitejs/vite/commit/b48b98ce0618eb3d142c0ce86a765502fb4ac190)), closes [#18995](https://github.com/vitejs/vite/issues/18995)
* feat(create-vite): extend from @vue/tsconfig to simplify tsconfig.app.json (#18862) ([89eea02](https://github.com/vitejs/vite/commit/89eea020a3723276495b950542e1c71f4ced781a)), closes [#18862](https://github.com/vitejs/vite/issues/18862)
* fix(deps): update all non-major dependencies (#18853) ([5c02236](https://github.com/vitejs/vite/commit/5c0223636fa277d5daeb4d93c3f32d9f3cd69fc5)), closes [#18853](https://github.com/vitejs/vite/issues/18853)
* fix(deps): update all non-major dependencies (#18967) ([d88d000](https://github.com/vitejs/vite/commit/d88d0004a8e891ca6026d356695e0b319caa7fce)), closes [#18967](https://github.com/vitejs/vite/issues/18967)
* fix(deps): update all non-major dependencies (#18996) ([2b4f115](https://github.com/vitejs/vite/commit/2b4f115129fb3fbd730a92078acb724f8527b7f7)), closes [#18996](https://github.com/vitejs/vite/issues/18996)
* chore(deps): update all non-major dependencies (#18916) ([ef7a6a3](https://github.com/vitejs/vite/commit/ef7a6a35e6827b92445e5a0c2c0022616efc80dd)), closes [#18916](https://github.com/vitejs/vite/issues/18916)
* refactor: fix logic errors found by no-unnecessary-condition rule (#18891) ([ea802f8](https://github.com/vitejs/vite/commit/ea802f8f8bcf3771a35c1eaf687378613fbabb24)), closes [#18891](https://github.com/vitejs/vite/issues/18891)



## <small>6.0.1 (2024-11-27)</small>

* feat(create-vite): bump vite-plugin-solid to `2.11.0` (#18792) ([32ac96f](https://github.com/vitejs/vite/commit/32ac96f54ca459d1a4c7ff7f4dbb4111eaea00f1)), closes [#18792](https://github.com/vitejs/vite/issues/18792)
85 changes: 38 additions & 47 deletions packages/create-vite/LICENSE
Original file line number Diff line number Diff line change
@@ -149,6 +149,23 @@ The published create-vite artifact additionally contains code with the following
ISC, MIT

# Bundled dependencies:
## @clack/core, @clack/prompts
License: MIT
By: Nate Moore
Repositories: https://github.com/natemoo-re/clack, https://github.com/natemoo-re/clack

> MIT License
>
> Copyright (c) Nate Moore
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------------

## cross-spawn
License: MIT
By: André Cruz
@@ -201,10 +218,10 @@ Repositories: git+https://github.com/isaacs/isexe.git, git://github.com/isaacs/n

---------------------------------------

## kleur
## mri
License: MIT
By: Luke Edwards
Repository: lukeed/kleur
Repository: lukeed/mri

> The MIT License (MIT)
>
@@ -230,32 +247,6 @@ Repository: lukeed/kleur

---------------------------------------

## minimist
License: MIT
By: James Halliday
Repository: git://github.com/minimistjs/minimist.git

> This software is released under the MIT license:
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of
> this software and associated documentation files (the "Software"), to deal in
> the Software without restriction, including without limitation the rights to
> use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
> the Software, and to permit persons to whom the Software is furnished to do so,
> subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all
> copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
> FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
> COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
> IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------------

## path-key, shebang-regex
License: MIT
By: Sindre Sorhus
@@ -296,10 +287,27 @@ Repository: alexeyraspopov/picocolors

---------------------------------------

## prompts, sisteransi
## shebang-command
License: MIT
By: Kevin Mårtensson
Repository: kevva/shebang-command

> MIT License
>
> Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------------

## sisteransi
License: MIT
By: Terkel Gjervig
Repositories: terkelg/prompts, https://github.com/terkelg/sisteransi
Repository: https://github.com/terkelg/sisteransi

> MIT License
>
@@ -322,20 +330,3 @@ Repositories: terkelg/prompts, https://github.com/terkelg/sisteransi
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> SOFTWARE.

---------------------------------------

## shebang-command
License: MIT
By: Kevin Mårtensson
Repository: kevva/shebang-command

> MIT License
>
> Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 4 additions & 4 deletions packages/create-vite/README.md
Original file line number Diff line number Diff line change
@@ -8,25 +8,25 @@
With NPM:

```bash
$ npm create vite@latest
npm create vite@latest
```

With Yarn:

```bash
$ yarn create vite
yarn create vite
```

With PNPM:

```bash
$ pnpm create vite
pnpm create vite
```

With Bun:

```bash
$ bun create vite
bun create vite
```

Then follow the prompts!
4 changes: 0 additions & 4 deletions packages/create-vite/build.config.ts
Original file line number Diff line number Diff line change
@@ -15,10 +15,6 @@ export default defineBuildConfig({
minify: true,
},
},
alias: {
// we can always use non-transpiled code since we support node 18+
prompts: 'prompts/lib/index.js',
},
hooks: {
'rollup:options'(_ctx, options) {
options.plugins = [
10 changes: 4 additions & 6 deletions packages/create-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-vite",
"version": "6.0.1",
"version": "6.3.1",
"type": "module",
"license": "MIT",
"author": "Evan You",
@@ -33,12 +33,10 @@
"homepage": "https://github.com/vitejs/vite/tree/main/packages/create-vite#readme",
"funding": "https://github.com/vitejs/vite?sponsor=1",
"devDependencies": {
"@types/minimist": "^1.2.5",
"@types/prompts": "^2.4.9",
"@clack/prompts": "^0.10.0",
"cross-spawn": "^7.0.6",
"minimist": "^1.2.8",
"mri": "^1.2.0",
"picocolors": "^1.1.1",
"prompts": "^2.4.2",
"unbuild": "^3.0.0-rc.11"
"unbuild": "^3.5.0"
}
}
Loading