http-vue-loader icon indicating copy to clipboard operation
http-vue-loader copied to clipboard

Not Working in Phonegap

Open narraressan opened this issue 7 years ago • 5 comments

Hi. Good evening. Sorry if this is a bit of a novice question but I am a bit lost and would like some expert to advise.

I have a working vue app with this library to load asynch components. However when I experimented on it on phonegap, the components with httpVueLoader("vue/components/mainApp.vue") is not working and not showing in the phonegap mobile preview. However, when I tested it on the browser, its working perfectly...

Here is an example of what I experiemnted...

var vueApp = new Vue({
	el: "#asugfr-app",
	data: {
		txt: "hello world!",
	},
	components: {
	     "myComponent": { template: "<div>A custom component!</div>" },
	     "mainApp": httpVueLoader("vue/components/mainApp.vue")
        },
	methods: {},
	mounted: function(){ 
		console.log("App is running!");
	},
	watch: {}
});

the component loads perfectly in both phonegap preview and browser, however, only works in browser.

Any suggestions or ideas of I am doing wrong?

narraressan avatar Feb 02 '18 16:02 narraressan

can you see any errors in the console ?

FranckFreiburger avatar Feb 13 '18 07:02 FranckFreiburger

Same here

D/SystemWebChromeClient: file:///.../cordova-hot-code-push-plugin/2019.05.24-16.47.55/www/libs/vue-2.6.10/vue-dev.js: Line 634 : [Vue warn]: Failed to resolve async component: function () {

                                     return new Component(name).load(url)
                                         .then(function (component) {

                                             return component.normalize();
                                         })
                                         .then(function (component) {

                                             return component.compile();
                                         })
                                         .then(function (component) {

                                             var exports = component.script !== null ? component.script.module.exports : {};

                                             if (component.template !== null)
                                                 exports.template = component.template.getContent();

                                             if (exports.name === undefined)
                                                 if (component.name !== undefined)
                                                     exports.name = component.name;

                                             return exports;
                                         })
                                 }

Well, nnot same. It worked when I did a clean build of the app and did not use cordova hot-code-push. But with it, it does not work any more. I can see in the Chrome remot device debug tools that the vue file is found correctly. Any hints?

jahrralf avatar May 24 '19 15:05 jahrralf

http-vue-loader, the awesome piece of software, also works in my cordova app. No changes were necessary. However, it is a HTTP view loader. loading from file:// did not work for me, had to get the .vue files from a webserver.

The strange issue with cordova-hot-code-push is still unclear.

jahrralf avatar May 25 '19 01:05 jahrralf

I have the same issue. Any suggestions?

pedromacarmo avatar Dec 14 '20 18:12 pedromacarmo

Add solution on a pull request #123

Trukes avatar Dec 15 '20 16:12 Trukes