FranckFreiburger / http-vue-loader

load .vue files from your html/js
MIT License
1.48k stars 274 forks source link

Not Working in Phonegap #31

Open narraressan opened 6 years ago

narraressan commented 6 years ago

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?

FranckFreiburger commented 6 years ago

can you see any errors in the console ?

jahrralf commented 5 years ago

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 commented 5 years ago

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.

pedromacarmo commented 3 years ago

I have the same issue. Any suggestions?

Trukes commented 3 years ago

Add solution on a pull request #123