Skip to content

Vite dev server optimize entries #18261

@edikdeisling

Description

@edikdeisling

Current behavior

I have a problems with component tests
If I add node_modules dependency into support file - this dependency wouldn't be pre-bundled by Vite. This is because Cypress pass supportFile into optimizeDeps.entries as is - and this is wrong for windows.

cypress/npm/vite-dev-server/src/startServer.ts
image

optimizeDeps.entries is array of fast-glob patterns

Desired behavior

All node_modules dependencies which are imported inside supportFile must be pre-bundled on windows too

Test code to reproduce

I've created repo to reproduce this
https://github.com/edikdeisling/test-cypress-cmp-tests-pre-bundling

Make sure there is no .vite in node_modules and run yarn test:component:run
image

Cypress Version

8.4.1

Other

There is another issue here to be honest. I think this is wrong to rewrite optimizeDeps.entries. Because of this behaviour I can't add my own optimizeDeps.entries
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    CTIssue related to component testingOS: windows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions