I managed to achieve the solution by just adding another parameter to the lazyLoad-Resolve cause I was having a similar problem:
lazyLoad: ['$q', '$transition$', function($q, $transition$) {
const deferred = $q.defer();
const $ocLazyLoad = $transition$.injector().get("$ocLazyLoad");
// Async require => Split point
require.ensure([], () => {
//
// All the code here, plus the required modules
// will be bundled in a separate file.
let module = require('../secure/app.secure.module.ajs');
//
// OCLazyLoad's 'load' function loads the Angular module.
$ocLazyLoad.load({name: 'collphir.customer-secure'});
deferred.resolve(module);
}, 'secure/secure');
return deferred.promise;
}]
The line
}**, 'secure/secure'**);
is the solution. Took me a while to find this one on the internet... No need for the extra-webpack.config.js. Also, there is a weird thing with the solution suggestion by @Cofad: Only the lazy chunk runs through this switch-case, so actually it is not necessary to differentiate. Also, I can't use the lazy-chunk's [name] cause it doesn't have one so I tried it with the [id], but this does change when building in prod-mode. So I tried it with the [debugId] which seemed to stay the same. It felt very unstable to me though...