sand4rt/playwright-ct-web

Remove vite as dependency

davidenke opened this issue · 3 comments

The tests projects are created with Vite however Vite is not required

@sand4rt just a question, as the plugin is loaded in ct-web, how can one opt-out of Vite?

Originally posted by @davidenke in #1 (comment)


As mentioned in #1, Vite should not be required for running tests. Maintaining a separate build stack in addition to the existing one, or in case of a bundler less config, this shouldn't be necessary imho. Maybe it should become a peer dep, which is only used once found installed?

@davidenke Thanks for creating the issue. I think this issue needs to be resolved at Playwright first. See related items: microsoft/playwright#20193 and microsoft/playwright#19693

Could you maybe mark vite as peer dependency?
Then others can bring their own version.

My scenario:

The vite version of your package does not align with the version I am getting from another package

package name package version vite version
@nx/vite 16.7.1 4.3.9
@sand4rt/experimental-ct-web 1.37.0 4.4.9

https://github.com/sand4rt/playwright-ct-web/blob/082ac4015ca920ffcba7f7d0d9e1700dd183b760/playwright-ct-web/package.json#L46C5-L46C5

This is the error I am getting:

'import("nx-lit-vite/node_modules/.pnpm/vite@4.3.9_wpe6fcgbhfxlajkgyzr4kv4joe/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 
'import("nx-lit-vite/node_modules/.pnpm/vite@4.4.9_wpe6fcgbhfxlajkgyzr4kv4joe/node_modules/vite/dist/node/index").PluginOption'.
                                                    Type 'PluginOption[]' is not assignable to type 'PluginOption'.

The fix is rather easy, I just need to align the version manually with the version your package requires.
But non the less, I think your package should not enforce the exact version, but rather just the minimum.

The big disadvantage for you is to keep track which versions of vite actually match with your library.
My hope would be that this is anyways managed but the @playwright/test package, so that you don't need to track it.

What are your thoughts on this @sand4rt ?

I've just released the change