2015-11-26 23 views
2

我的應用程序的JavaScript坐落在一個不同的域名中的index.html的WebPack和oclazyload - 指定完整網址需要()

使用真棒ocLazyLoad時,這引起了我的問題。對於延遲加載模塊將請求在index.html住在域作出

例如: -

的index.html = https://domain.com/index.html

app.bundle.js = https://different-domain.com/js/app.bundle.js

請求延遲裝入束變爲= https://domain.com/1.1.bundle.js

當它應該是:https://different-domain.com/js/1.1.bundle.js

路線的決心:

resolve: { 
    load: function ($q, $ocLazyLoad) { 
     let deferred = $q.defer(); 
     require.ensure([], function() { 
      let module = require('./path/to/module.js'); 
      $ocLazyLoad.load({ 
       name: 'moduleName'    
      }); 
      deferred.resolve(module); 
     }); 
     return deferred.promise; 
    } 
} 

有誰知道我怎麼能保證GET請求正道取得?

回答

1

我在webpack gitter上問過這個問題,有人向我指出解決問題的方向output.publicPath