Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite reads electron base path in a project using vue-cli-plugin-electron-builder. #31

Closed
logue opened this issue May 25, 2021 · 5 comments

Comments

@logue
Copy link

logue commented May 25, 2021

Vite is will read the basePath to be used in the vue-cli-plugin-electron-builder.

PS E:\Documents\my-electron-project> npm run vite

> my-electron-project@0.0.0 vite
> node ./bin/vite

running: vite --config E:\Documents\my-electron-project\node_modules\vue-cli-plugin-vite\config\index.ts
error when starting dev server:
Error: The following dependencies are imported but could not be resolved:

  app://./js/chunk-vendors~0f485567.aa229120.js (imported by E:/Documents/my-electron-project/dist_electron/bundled/index.html)
  app://./js/chunk-vendors~45d1a9fe.1855cc83.js (imported by E:/Documents/my-electron-project/dist_electron/bundled/index.html)
  app://./js/chunk-vendors~167fad9f.19379aa7.js (imported by E:/Documents/my-electron-project/dist_electron/bundled/index.html)
  app://./js/chunk-vendors~e4173fa2.bd5eeaa2.js (imported by E:/Documents/my-electron-project/dist_electron/bundled/index.html)
  app://./js/chunk-vendors~d939e436.a66345e0.js (imported by E:/Documents/my-electron-project/dist_electron/bundled/index.html)
@IndexXuan
Copy link
Owner

I dont know what you said.

@IndexXuan
Copy link
Owner

IndexXuan commented May 25, 2021

if you use some vue-cli-plugin, you should find or write the same plugin in vite-plugin and pass in.

https://github.com/nklayman/vue-cli-plugin-electron-builder/blob/master/index.js
this file modify lots of webpack-config and you should use vite-plugin to do the same thing.

@logue
Copy link
Author

logue commented May 25, 2021

I'm sorry, I was asleep and wrote.
This project is based on the assumption that the binaries for the Web and Electron will be generated from the same code.
Looking at the logs, it seems that I'm trying to load the code generated by vue-cli-plugin-electron-builder in dist_electron.

this file modify lots of webpack-config and you should use vite-plugin to do the same thing.

So, is it possible to have vite do only the vue-cli-service serve and vue-cli-service build parts instead of rewriting everything to vite?

@IndexXuan
Copy link
Owner

yes this plugin only do dev(serve). but it seems serve stage read dist as well. I do think it is possible to write vite-plugin do the same thing with vue-cli. e.g.

https://github.com/cawa-93/vite-electron-builder

but it is not easy.

@IndexXuan
Copy link
Owner

for example: we have some project use vue-cli-plugin-auto-routing and vue-cli-plugin-mock and so on. we should use this plugin and write vite-plugin-auto-routing and vite-plugin-mock to do the same thing and pass in the vue.config.js#pluginOptions.vite.plugins.
see #9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants