-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support vite v5 #29518
Merged
Merged
feat: support vite v5 #29518
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5927129
feat: support vite v5 [run ci]
AtofStryker ac6e96d
make sure to use correct path in windows if no cypress public path is…
AtofStryker f67eb53
update snapshot [run ci]
AtofStryker 43615a6
update docs on devServerPublicPathRoute for vite-dev-server
AtofStryker 39469c0
update comments
AtofStryker c6941da
Merge branch 'develop' into feat/vite_5_support
jennifer-shehane 029f558
refactor resolveConfig test
AtofStryker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import debugFn from 'debug' | ||
import type { UserConfig } from 'vite' | ||
import semverMajor from 'semver/functions/major' | ||
import type { UserConfig } from 'vite-5' | ||
import { getVite, Vite } from './getVite' | ||
import { createViteDevServerConfig } from './resolveConfig' | ||
|
||
|
@@ -8,7 +9,6 @@ const debug = debugFn('cypress:vite-dev-server:devServer') | |
const ALL_FRAMEWORKS = ['react', 'vue'] as const | ||
|
||
type ConfigHandler = UserConfig | (() => UserConfig | Promise<UserConfig>) | ||
|
||
export type ViteDevServerConfig = { | ||
specs: Cypress.Spec[] | ||
cypressConfig: Cypress.PluginConfigOptions | ||
|
@@ -23,6 +23,15 @@ export async function devServer (config: ViteDevServerConfig): Promise<Cypress.R | |
// This has to be the first thing we do as we need to source vite from their project's dependencies | ||
const vite = getVite(config) | ||
|
||
let majorVersion: number | undefined = undefined | ||
|
||
if (vite.version) { | ||
majorVersion = semverMajor(vite.version) | ||
debug(`Found vite version v${majorVersion}`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is only added for debugging purposes, which becomes more important as we add versions |
||
} else { | ||
debug(`vite version not found`) | ||
} | ||
|
||
debug('Creating Vite Server') | ||
const server = await devServer.create(config, vite) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems really weird to me that we don't have specific bundler docs for CT. Shouldn't this be documented as an option in the component config here? https://docs.cypress.io/guides/references/configuration#component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would think so, but I am not sure why it isn't documented. Was it something we wanted as an option but not to be widely surfaced or was the documentation just missed?