vikseriq / requirejs-vue

Use Vue components with RequireJS. Easily. Client-side.
42 stars 6 forks source link

Vue pages are not loaded in iOS (cordova) #4

Open smarinier opened 2 years ago

smarinier commented 2 years ago

In an iOS application (using cordova), the XMLHTTPRequest doesn't work, as the iOS Web view forbids external queries, aso...

My workaround (and advice) is to use the same strategy as the "json!" require plugins, wich uses the "text!" plugins. This looks like :

define(['module', 'text'], function(module, text){
  'use strict';

  var fetchContent = null,
    moduleVersion = '1.1.5',
    masterConfig = {
      isBuild: false,
      currentImport: ''
    },
    buildMap = {};

  if (typeof window !== 'undefined' && window.document){

    fetchContent = function(url, callback){
        // use "text" module
        text.get(url, function (data) {
            callback(data);
        });
    };

} else {

vikseriq commented 2 years ago

Thanks for the insight, will investigate case locally and push update if needed.