IndexXuan / vue-cli-plugin-vite

Use vite today, with vue-cli.

Home Page:https://github.com/IndexXuan/vue-cli-plugin-vite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

logue opened this issue · comments

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)

I dont know what you said.

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.

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?

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.

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