angular2-webpack2-lazy-children-loader
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -14,6 +14,6 @@ "use strict"; | ||
if (tmp.length < 2) { | ||
return 'System.import("' + fpath + '")()'; | ||
return 'System.import("' + fpath + '")();'; | ||
} else { | ||
moduleName = addSuffix ? tmp[1] + "NgFactory" : tmp[1] | ||
return 'System.import("' + fpath + '").then(m => m["' + moduleName + '"])'; | ||
moduleName = addSuffix ? tmp[1] + "NgFactory" : tmp[1]; | ||
return 'System.import("' + fpath + '").then(function(m) { return m["' + moduleName + '"]; });'; | ||
} | ||
@@ -29,5 +29,5 @@ }); | ||
if (trimmed[0] !== '"' && trimmed[0] !== "'") return match; | ||
return 'loadChildren: () =>' + replacePath(path, addSuffix); | ||
return 'loadChildren: function() { return ' + replacePath(path, addSuffix) + ' }'; | ||
}); | ||
return newSource; | ||
}; |
{ | ||
"name": "angular2-webpack2-lazy-children-loader", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A webpack loader for ng2 lazy loading", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,3 +8,3 @@ var assert = require("assert"); | ||
var inputSource = `{ loadChildren: "./subModule#SubModule" }`; | ||
var expected = `{ loadChildren: () => System.import("./subModule").then(m => m["SubModule"]) }`; | ||
var expected = `{ loadChildren: function() { return System.import("./subModule").then(function(m) { return m["SubModule"]; }); } }`; | ||
var actual = loader.bind({ cacheable: false, resourcePath: "./app.routing.ts" })(inputSource); | ||
@@ -16,3 +16,3 @@ assert.equal(actual, expected); | ||
var inputSource = `{ loadChildren: "./subModule#SubModule" }`; | ||
var expected = `{ loadChildren: () => System.import("./subModule").then(m => m["SubModule"]) }`; | ||
var expected = `{ loadChildren: function() { return System.import("./subModule").then(function(m) { return m["SubModule"]; }); } }`; | ||
var actual = loader.bind({ cacheable: false, resourcePath: "./app.routing.ts" })(inputSource); | ||
@@ -24,3 +24,3 @@ assert.equal(actual, expected); | ||
var inputSource = `{ loadChildren: "./subModule#SubModule" }`; | ||
var expected = `{ loadChildren: () => System.import("./subModule.ngfactory").then(m => m["SubModuleNgFactory"]) }`; | ||
var expected = `{ loadChildren: function() { return System.import("./subModule.ngfactory").then(function(m) { return m["SubModuleNgFactory"]; }); } }`; | ||
var actual = loader.bind({ cacheable: false, resourcePath: "./app.module.ngfactory.ts" })(inputSource); | ||
@@ -27,0 +27,0 @@ assert.equal(actual, expected); |
6050