aklinker1 / vite-plugin-web-extension

Vite plugin for developing Chrome/Web Extensions
https://vite-plugin-web-extension.aklinker1.io/
MIT License
537 stars 46 forks source link

pnpm create vite-plugin-web-extension error occurred #163

Closed defghy closed 7 months ago

defghy commented 7 months ago

Summary

pnpm + vue + ts output log below

> aweb-extension@1.0.0 dev /Users/happyelements/project/test/aweb-extension
> vite

Build Steps
  1. Building src/popup.html indvidually
  2. Building src/background.ts indvidually

  VITE v5.0.5  ready in 734 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help

Building src/popup.html (1/2)
vite v5.0.5 building for development...
✓ 2 modules transformed.
dist/src/popup.html  0.48 kB │ gzip: 0.28 kB
dist/src/popup.js    0.71 kB │ gzip: 0.40 kB
✓ built in 93ms

dist/icon/128.png changed, restarting browser

dist/icon/16.png changed, restarting browser

dist/icon/32.png changed, restarting browser

dist/icon/48.png changed, restarting browser

dist/icon/96.png changed, restarting browser

dist/icon-with-shadow.svg changed, restarting browser

dist/src/popup.js changed, restarting browser

dist/src/popup.html changed, restarting browser
16:49:34 [vite] page reload dist/src/popup.html

Building src/background.ts (2/2)
vite v5.0.5 building for development...

watching for file changes...

build started...
transforming (1) src/background.ts
dist/icon/128.png changed, restarting browser

dist/icon/16.png changed, restarting browser

dist/icon/32.png changed, restarting browser

dist/icon/48.png changed, restarting browser

dist/icon/96.png changed, restarting browser

dist/icon-with-shadow.svg changed, restarting browser
✓ 4 modules transformed.
dist/src/background.js  10.01 kB │ gzip: 2.98 kB
built in 164ms.

dist/src/background.js changed, restarting browser

✓ Wrote manifest.json

Opening browser...

dist/manifest.json changed, restarting browser

dist/icon-with-shadow.svg changed, restarting browser

dist/icon/96.png changed, restarting browser

dist/icon/48.png changed, restarting browser

dist/icon/32.png changed, restarting browser

dist/icon/16.png changed, restarting browser

dist/icon/128.png changed, restarting browser
file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite-plugin-web-extension@3.2.0_vite@5.0.5/node_modules/vite-plugin-web-extension/dist/index.js:796
      return runner.exit();
                    ^
TypeError: Cannot read properties of undefined (reading 'exit')
    at Object.exit (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite-plugin-web-extension@3.2.0_vite@5.0.5/node_modules/vite-plugin-web-extension/dist/index.js:796:21)
    at Context.watchChange (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite-plugin-web-extension@3.2.0_vite@5.0.5/node_modules/vite-plugin-web-extension/dist/index.js:1172:65)
    at hookParallel (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:62799:47)
    at Object.watchChange (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:63285:19)
    at FSWatcher.<anonymous> (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:59768:25)
    at FSWatcher.emit (node:events:525:35)
    at FSWatcher.emit (node:domain:489:12)
    at FSWatcher.emitWithAll (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:47072:8)
    at FSWatcher._emit (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:47164:8)
    at FsEventsHandler.handleEvent (file:///Users/happyelements/project/test/aweb-extension/node_modules/.pnpm/vite@5.0.5/node_modules/vite/dist/node/chunks/dep-MF_y65BT.js:46295:14)
 ELIFECYCLE  Command failed with exit code 1.

If applicable, add screenshots to help explain your problem.

Reproduction

Environment

template: pnpm + vue + ts os: macos 13.5.1 nodejs: 16.20.2 pnpm: 8.11.0 vite-plugin-web-extension: 3.2.0

Paste output here
defghy commented 7 months ago

update vite-plugin-web-extension to 4.0.0 error fixed do not know why create vite-plugin-web-extension not use 4.0.0

aklinker1 commented 7 months ago

I'll update the template to use the latest major version 👍

This is caused by vite 5, and is fixed by v4 like you point out