Skip to content

Commit 7d7ef21

Browse files
Broccofilipesilva
authored andcommitted
feature(route): allow lazy route reference by relative paths (angular#2434)
1 parent 06976f4 commit 7d7ef21

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/angular-cli/models/find-lazy-modules.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ export function findLazyModules(projectRoot: any): {[key: string]: string} {
5555
glob.sync(path.join(projectRoot, '/**/*.ts'))
5656
.forEach(tsPath => {
5757
findLoadChildren(tsPath).forEach(moduleName => {
58-
const fileName = path.resolve(projectRoot, moduleName) + '.ts';
58+
let fileName = path.resolve(projectRoot, moduleName) + '.ts';
59+
// If path is a relative path
60+
if (moduleName.startsWith('.')) {
61+
const tsPathInfo = path.parse(tsPath);
62+
fileName = path.resolve(tsPathInfo.dir, moduleName) + '.ts';
63+
}
5964
if (fs.existsSync(fileName)) {
6065
// Put the moduleName as relative to the main.ts.
6166
result[moduleName] = fileName;

0 commit comments

Comments
 (0)