wxt-dev / wxt

⚡ Next-gen Web Extension Framework
https://wxt.dev
MIT License
4.6k stars 192 forks source link

Bump Vite version #1015

Closed aryzing closed 1 month ago

aryzing commented 1 month ago

Feature Request

Vite's latest is 5.4.8, WXT using 5.3.5.

Is your feature request related to a bug?

There's a type incompatibility for ESBuild plugins such as

import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';

// ...

export default defineConfig({
  // ...
  vite: () =>
    defineViteConfig({
      optimizeDeps: {
        esbuildOptions: {
          plugins: [
            // @ts-expect-error - There seems to be an issue with the types of
            // the version of Vite used by WXT.
            NodeGlobalsPolyfillPlugin({
              buffer: true,
              process: true,
            }),
          ],
        },
      },
    }),
});

What are the alternatives?

Using @ts-expect-error

aiktb commented 1 month ago

Not sure if it's related, I put two projects of wxt and remix in a pnpm repo, and since remix needs to use vite, and pnpm doesn't have dependency hoist, so I installed vite directly in devDeps.

Whenever I installed a different version of vite than wxt depends on, the types in vite.config.ts would be broken, my usecase is build.css.postcss.

I now use a normal postcss.config.js to avoid this.

1natsu172 commented 1 month ago

@aryzing To begin with, wxt can use 5.4.8 in semver way. And what are you using for your package manager? pnpm often breaks rollup peer dependencies lol.

image

All I know is to run either of those two to repair the lockfile

and then re-install(pnpm i).

(cc: @aiktb)

Timeraa commented 1 month ago

For these kinds of inconsistencies I just overwrite the version of vite in the package.json since they are so tightly coupled a lot of the times

aklinker1 commented 1 month ago

I'm gonna close this since it's unrelated to WXT, more an issue with rollup subdepednencies and PNPM.

But yeah, if you want to upgrade Vite, but not list it in your package.json:

pnpm i vite@latest # or whatever version you need
pnpm rm vite
pnpm i --fix-lockfile

You may be able to just do pnpm upgrade vite instead of adding and removing it, but I don't know if that works on subdependencies.