vue-cli-plugin-cordova icon indicating copy to clipboard operation
vue-cli-plugin-cordova copied to clipboard

Can you support vite2

Open luocong2016 opened this issue 3 years ago • 1 comments

Can you support vite2.

luocong2016 avatar Jul 01 '21 09:07 luocong2016

Hello @luocong2016 ,

I don't think, this can't easily be done.

This plugin is based on vue-cli, which uses webpack to build etc...

Vite replaces completely this process. So it would require some research on how to implement correctly...

Basically for dev build, it's spinning up a dev server with vue-cli and injecting in the webpack build process with

https://github.com/m0dch3n/vue-cli-plugin-cordova/blob/64a13fa9477f8a3e2dd8152667908bea2f9760d2/index.js#L162

the cordova.js file to load the cordova plugins from js side...

After the dev server is running, it is instructing cordova to not load the local files from cordova's www folder, but from the dev server...

https://github.com/m0dch3n/vue-cli-plugin-cordova/blob/64a13fa9477f8a3e2dd8152667908bea2f9760d2/index.js#L199

For production build, I think it's easier to replace...

Instead of letting vue-cli build, then copying files to cordova's www folder, you just need to let vite build...

But I'm not sure, and haven't tried anything on this, as I do not have time for that... But feel free to further investigate and analyse the building possibilities with vite...

m0dch3n avatar Aug 13 '21 07:08 m0dch3n