m0dch3n / vue-cli-plugin-cordova

Vue Cli 3 Cordova Plugin
MIT License
417 stars 63 forks source link

content src in the config.xml does not change #54

Closed inyourhands closed 5 years ago

inyourhands commented 5 years ago

Hi. When I first execute the command "npm run cordova-build-ios", the content src value in the cordova config.xml file looks like this:

<content src="index.html" />

But the second time i run the command "npm run cordova-serve-ios", it changes as follows.

<content src="http://192.168.219.109:8080" />
<allow-navigation href="http://192.168.219.109:8080" />

I think it's normal now. However, I run the command "npm run cordova-build-ios" again after that, the above value will not be reset to the value shown below.

<content src="index.html" />

I think it should change to the original, but it does not.

Is it a bug? Or did I misunderstand? (please understand my poor english)

m0dch3n commented 5 years ago

well it's not a bug, that this changes during development, this is even documented in the README.

Basically in development, npm run serve is executed and cordova run, and the cordova webview is pointing to your dev server...

maybe your IDE or Linter or something else is touching the file too, so my regexp is not working:

https://github.com/m0dch3n/vue-cli-plugin-cordova/blob/adc8dd0221b992dae99e4e3192b098209f60c280/index.js#L109-L124

or the SIGTERM are note catched, to reset the file, when you kill the command:

https://github.com/m0dch3n/vue-cli-plugin-cordova/blob/adc8dd0221b992dae99e4e3192b098209f60c280/index.js#L176-L181

inyourhands commented 5 years ago

Thank you for explanation~

inyourhands commented 5 years ago

I suggest one thing. I would like the cordovaContent function to be executed within the runBuild function. This is because dev server ip(http://192.168.219.109:8080) does not change to index.html even when the npm run cordova-serve-* function is executed.

Or, would you be grateful if you could tell me the order of commands that dev server ip(http://192.168.219.109:8080) could change to index.html when I run the npm run cordova-serve-* command after changed dev server ip(http://192.168.219.109:8080).

Thank you for your efforts and this project

m0dch3n commented 5 years ago

During runBuild it's not possible, runBuild is for production build, and runServe for development. A build should not point to a dev server...

during serve, changeContent is executed to let cordova point to your dev server, and on a sigterm signal it's rollbacked... So if it does not rollback to index.html, please check, why the sigterm is not catched in your case. Maybe you (or your IDE) are not correctly stopping the serve command...

inyourhands commented 5 years ago

You mean that dev server ip(http://192.168.219.109:8080) rollback automatically when npm run cordova-serve-* command stops?

Well... i'm using Vue-CLI-GUI tool and VSCode. I will check again what went wrong.

I'm sorry to bother you & thank you~ ^_____^*

m0dch3n commented 5 years ago

yeah, exactly, if SIGINT or SIGTERM are thrown, the config is reverted to index.html

m0dch3n commented 5 years ago

line 176-181 as on my first post here

ponponner commented 5 years ago

When installing or running scripts, the console worked well, but VueUI(on windows) did not. It may be nice to say about it in the README.