question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vite dev server optimize entries

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
userquincommented, Sep 28, 2021

@edikdeisling @lmiller1990 I’m fixing this, just testing:

imagen

with result on @edikdeisling fork:

imagen

1reaction
lmiller1990commented, Sep 28, 2021

We should be concat-ing with the optimizeDeps, not overwriting. Good catch, will look into both these.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dep Optimization Options - Vite
optimizeDeps.entries # ... By default, Vite will crawl all your .html files to detect dependencies that need to be pre-bundled (ignoring node_modules ,...
Read more >
Configuring Vite
... determine options based on the command ( dev / serve or build ), the mode ... during dev, the config is shared...
Read more >
Building for Production - Vite
When it is time to deploy your app for production, simply run the vite build command. By default, it uses <root>/index.html as the...
Read more >
Build Options - Vite
The value can be a string to directly specify the SSR entry, or true , which requires specifying the SSR entry via rollupOptions.input...
Read more >
Command Line Interface - Vite
Start Vite dev server in the current directory. Will enter the watch mode in ... --force, Force the optimizer to ignore the cache...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found