2

Earlier versions of angular oclazyload had an option to configure asyncLoader to use webpack bundle loader as its script loader.

app.config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider) {
        $ocLazyLoadProvider.config({
            asyncLoader: function (expr, callback) {
                var load = require('bundle?lazy!oclazyDir/out/' + expr + '.js');
                load(function (file) {
                    callback(null, file);
                });
            }
        });
    }
]);

How to achieve the same with the latest version of angular oclazyload. Replacing asyncLoader with jsLoader also didn't work out.

Gowrav
  • 627
  • 7
  • 22

1 Answers1

0

This may not answer your question completely, but I discovered that there is a separate flavor of oclazyload that is tailored for RequireJS (https://github.com/ocombe/ocLazyLoad/blob/1.0.9/dist/ocLazyLoad.require.js). This wasn't mentioned in the documentation, so it took a while for me to find it..

There is also this helpful answer from the author of oclazyload outlining why RequireJS is unnecessary if you're using oclazyload: https://stackoverflow.com/a/28961833/2449100

I hope this helps!

Community
  • 1
  • 1
Eddie Hong
  • 88
  • 9