ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

[Web pack with ocLazyLoad] Fails to load the controller and template #423

Open manjudr opened 6 years ago

manjudr commented 6 years ago
    var templatePath = require('../templatePath');
    var controllerPath = require('../ControllerPath');
    $scope.loadNgModules = function(templatePath, controllerPath) {
            var files = [];
            if (templatePath) files.push({ type: 'html', path: templatePath });
            if (controllerPath) files.push({ type: 'js', path: controllerPath });
            if (files.length) return $ocLazyLoad.load(files)
        };

When I use webpack for minification ocLazyLoad is not working with webpack. Since I guess ocLazyLoad accepts only path of the template and controller but webpack is bundling both template and controller into the single minified file so it fails to load.

Webpack plugin name : uglifyjs-webpack-plugin'

Is there any way to accomplish this problem using ocLazyLoad.? Can I load a string of template and controller file other than the path.?