My application's javascript sits on a different domain to the index.html
This causes me a problem when using the awesome ocLazyLoad. The request for the lazy loaded module is made from the domain the index.html lives in.
eg:-
index.html = https://domain.com/index.html
app.bundle.js = https://different-domain.com/js/app.bundle.js
Request for lazy loaded bundle becomes = https://domain.com/1.1.bundle.js
When it should be: https://different-domain.com/js/1.1.bundle.js
route resolve:
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;
}
}
Does anyone know how I could ensure the get request is made to the right path?
I asked this question on the webpack gitter and someone kindly pointed me in the direction of output.publicPath
which solves the problem.