antfu-collective / vitesse-webext

⚡️ WebExtension Vite Starter Template
MIT License
2.93k stars 225 forks source link

branch:refactor/mv3 Popup shows "Vite server did not start" #99

Closed heavenkiller2018 closed 2 years ago

heavenkiller2018 commented 2 years ago

Describe the bug

I donwloaded the latest mv3 branch, and then run it:

npx degit antfu/vitesse-webext#refactor/mv3 antfu@vitesse-webext_mv3
❯ npm run dev

> vitesse-webext@0.0.1 dev
> npm run clear && cross-env NODE_ENV=development run-p dev:*

> vitesse-webext@0.0.1 clear
> rimraf extension extension.*

> vitesse-webext@0.0.1 dev:js
> npm run build:js -- --mode development

> vitesse-webext@0.0.1 dev:bg
> tsup --watch ./src

> vitesse-webext@0.0.1 dev:prepare
> esno scripts/prepare.ts

> vitesse-webext@0.0.1 dev:web
> vite

CLI Building entry: {"background/index":"./src/background/index.ts","mv3client":"./scripts/client.ts"}
CLI Using tsconfig: tsconfig.json
CLI tsup v5.12.9
CLI Using tsup config: /home/john/project/testscratch/git-repos/antfu@vitesse-webext_mv3/tsup.config.ts
CLI Running in watch mode
CLI Target: esnext
ESM Build start
ESM ⚡️ Build success in 36ms
ESM extension/dist/mv3client.mjs        52.13 KB
ESM extension/dist/background/index.mjs 162.94 KB
CLI Watching for changes in "./src"
CLI Ignoring changes in "**/{.git,node_modules}/**" | "extension/dist" | "**/extension/**"

> vitesse-webext@0.0.1 build:js
> vite build --config vite.config.content.ts --mode development

build.terserOptions is specified but build.minify is not set to use Terser. Note Vite now defaults to use esbuild for minification. If you still prefer Terser, set build.minify to "terser".

  vite v2.9.15 dev server running at:

  > Local: http://localhost:3303/
  > Network: use `--host` to expose

  ready in 766ms.

vite v2.9.15 building for development...

watching for file changes...

build started...
transforming (12) contentScripts/views/App.vue PRE  write manifest.json
 PRE  stub options
 PRE  stub popup
✓ 21 modules transformed.
../extension/dist/contentScripts/style.css         3.11 KiB / gzip: 1.05 KiB
../extension/dist/contentScripts/index.global.js   96.18 KiB / gzip: 37.06 KiB
../extension/dist/contentScripts/index.global.js.map 702.67 KiB
built in 4854ms.

but the popup page show: Vite server did not start, why ? how to fix it?

Reproduction

reproduction

System Info

System:
    OS: Linux 5.15 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (8) x64 Intel Core Processor (Haswell, no TSX, IBRS)
    Memory: 25.33 GB / 31.35 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.0/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Firefox: 105.0

Used Package Manager

npm

Validations

heavenkiller2018 commented 2 years ago

I found what the problem is. my development enviroment is vscode remote (linux), but my local os is windows. so in vite-mv3-hmr.ts, isWin is false. I staticly set it to be true, then everything is ok! but there is another problem that it's not a real HMR which only need to refresh the web page to reflect the changes. In fact, I have to reload this extension to see the changes every time when the source code is modified? why? and how to improve it?

tmkx commented 2 years ago

In fact, I have to reload this extension to see the changes every time when the source code is modified? why? and how to improve it?

https://github.com/antfu/vitesse-webext/issues/59#issuecomment-1011008367, busy now, maybe I will have a look at it in some days 🤯.

heavenkiller2018 commented 2 years ago

I finally found what the problem is. I use raidrive to map the remote linux directory to local windows os with webdav, but there is delay in that manner when files syncing. I changed it to samba, then everything is ok! The HMR works😍😍😍