Skip to content

Commit

Permalink
feat(testing): Vite 5 compatibility for Cypress (#18535)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Aug 8, 2023
1 parent b8c3ec4 commit 38fec9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/cypress/src/plugins/preprocessor-vite.ts
Expand Up @@ -74,7 +74,9 @@ function vitePreprocessor(userConfigPath?: string): CypressPreprocessor {

cache.set(filePath, outputPath);

const { build } = require('vite');
const { build } = await (Function('return import("vite")')() as Promise<
typeof import('vite')
>);

const watcher = (await build({
configFile: userConfigPath,
Expand Down
4 changes: 3 additions & 1 deletion packages/react/plugins/component-testing/index.ts
Expand Up @@ -84,7 +84,9 @@ export function nxComponentTestingPreset(
const viteConfigPath = findViteConfig(normalizedProjectRootPath);

const { mergeConfig, loadConfigFromFile, searchForWorkspaceRoot } =
await import('vite');
await (Function('return import("vite")')() as Promise<
typeof import('vite')
>);

const resolved = await loadConfigFromFile(
{
Expand Down

1 comment on commit 38fec9c

@vercel
Copy link

@vercel vercel bot commented on 38fec9c Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev
nx-dev-nrwl.vercel.app

Please sign in to comment.