Skip to content

Commit

Permalink
feat(testing): Vite 5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Aug 8, 2023
1 parent b8c3ec4 commit 443c651
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 443c651

Please sign in to comment.