crxjs / chrome-extension-tools

Bundling Chrome Extensions can be pretty complex. It doesn't have to be.
https://crxjs.dev/vite-plugin
2.71k stars 181 forks source link

Version of Vite in "Getting started in 90 seconds" #520

Open BurtHarris opened 1 year ago

BurtHarris commented 1 year ago

Build tool

Vite

Where do you see the problem?

Describe the bug

In following the instructions for quick start (like this) I'm confused around the Vite dependency versions. I've read something that says this plugin is still not compatible with Vite 3. This leaves me unsure if the instruction to run npm init vite@latest needs to be altered. I tried:

npm init vite@2

... which chose dev dependency vite^2.9.15. This of course worked, but when the next step called for npm i @crxjs/vite-plugin -D, npm spews warnings while resolving: @vitejs/plugin-react@2.1.0.

I don't understand why react is involved here, I chose the vanilla-ts option. Perhaps a doc-only solution may be available by specifying a more specific version on the npm init command line?

@jacksteamdev Frankly I'm new to vite and this is a little above my head at this point. I would dig in, but the direction is unclear. Will the incompatibilities with Vite@3 be resolved? Should I dig into the Vite@2 path? Should I fallback to rollup?

Perhaps this is as simple as specifying an even earlier version on the npm-init

Reproduction

npm init vite@2 try-vite-2 cd try-vite-2 npm i @crxjs/vite-plugin -D

Logs

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: @vitejs/plugin-react@2.1.0
npm WARN Found: vite@2.9.15
npm WARN node_modules/vite
npm WARN   dev vite@"^2.9.15" from the root project
npm WARN   1 more (@crxjs/vite-plugin)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer vite@"^3.0.0" from @vitejs/plugin-react@2.1.0
npm WARN node_modules/@vitejs/plugin-react
npm WARN   optional @vitejs/plugin-react@">=1.2.0" from @crxjs/vite-plugin@1.0.14
npm WARN   node_modules/@crxjs/vite-plugin
npm WARN
npm WARN Conflicting peer dependency: vite@3.1.4
npm WARN node_modules/vite
npm WARN   peer vite@"^3.0.0" from @vitejs/plugin-react@2.1.0
npm WARN   node_modules/@vitejs/plugin-react
npm WARN     optional @vitejs/plugin-react@">=1.2.0" from @crxjs/vite-plugin@1.0.14
npm WARN     node_modules/@crxjs/vite-plugin

 packages in 4s

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (20) x64 Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz
    Memory: 17.98 GB / 31.90 GB
  Binaries:
    Node: 18.5.0 - ~\AppData\Local\nodejs\node.EXE
    Yarn: 1.22.15 - ~\AppData\Local\nodejs\yarn.CMD
    npm: 8.13.2 - ~\AppData\Local\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22621.521.0), Chromium (105.0.1343.53)
    Internet Explorer: 11.0.22621.1

Severity

annoyance

BurtHarris commented 1 year ago

Related to #479? I'm not sure.

Toumash commented 1 year ago

@BurtHarris im using below config just fine on production @ chrome web store

{
    "vite": "^2.9.4",
    "@vitejs/plugin-react": "^1.3.0",
    "@crxjs/vite-plugin": "^1.0.14",
}