aklinker1 / vite-plugin-web-extension

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

Try to run v2 but got `Error: Render Manifest: Bundle output not found for: popup/index.html at findReplacement` #74

Closed yujinlin0224 closed 1 year ago

yujinlin0224 commented 1 year ago

Since create-vite-plugin-web-extension still in v1, I try to use pnpm create vite-plugin-web-extension with Vue+Typescript to get vite-plugin-web-extension v1 project and migrate to v2 by myself, but when I try to start pnpm dev, I got this error:

error when starting dev server:
Error: Render Manifest: Bundle output not found for: popup/index.html
    at findReplacement (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite-plugin-web-extension@2.0.1_vite@3.1.2/node_modules/vite-plugin-web-extension/dist/index.js:976:11)
    at replaceEntrypoint (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite-plugin-web-extension@2.0.1_vite@3.1.2/node_modules/vite-plugin-web-extension/dist/index.js:990:43)
    at renderManifest (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite-plugin-web-extension@2.0.1_vite@3.1.2/node_modules/vite-plugin-web-extension/dist/index.js:950:3)
    at Context.buildStart (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite-plugin-web-extension@2.0.1_vite@3.1.2/node_modules/vite-plugin-web-extension/dist/index.js:1109:29)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 5)
    at async hookParallel (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite@3.1.2/node_modules/vite/dist/node/chunks/dep-cff57044.js:40728:9)
    at async Object.buildStart (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite@3.1.2/node_modules/vite/dist/node/chunks/dep-cff57044.js:40995:13)
    at async file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite@3.1.2/node_modules/vite/dist/node/chunks/dep-cff57044.js:62263:13       
    at async httpServer.listen (file:///D:/Projects/JavaScript/vue-plugin-project/node_modules/.pnpm/vite@3.1.2/node_modules/vite/dist/node/chunks/dep-cff57044.js:62278:17)

Then I found in https://github.com/aklinker1/vite-plugin-web-extension/tree/main/packages/demo-vue has already v2 demo, I also try to run but still got the same error.

yujinlin0224 commented 1 year ago

I think this error is specific to Windows, I switch to WSL and solved, but now I need to try to figured out how to run local web browser to debug from WSL...

yujinlin0224 commented 1 year ago

I found that change here https://github.com/aklinker1/vite-plugin-web-extension/blob/0379b2ee89e8e0a7798c6b248839243793f73de9/packages/vite-plugin-web-extension/src/utils.ts#L135-L138 to

 return inputs.map((file) => { 
   if (path.isAbsolute(file)) return path.relative(paths.rootDir, file).replace(/\\/g, "/");
   return file.replace(/\\/g, "/");
 }); 

can fix it

aklinker1 commented 1 year ago

Published in v2.0.2. Thanks for the PR!