Skip to content

feature(route): allow lazy route reference by relative paths #2434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/angular-cli/models/find-lazy-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ export function findLazyModules(projectRoot: any): {[key: string]: string} {
glob.sync(path.join(projectRoot, '/**/*.ts'))
.forEach(tsPath => {
findLoadChildren(tsPath).forEach(moduleName => {
const fileName = path.resolve(projectRoot, moduleName) + '.ts';
let fileName = path.resolve(projectRoot, moduleName) + '.ts';
// If path is a relative path
if (moduleName.startsWith('.')) {
const tsPathInfo = path.parse(tsPath);
fileName = path.resolve(tsPathInfo.dir, moduleName) + '.ts';
}
if (fs.existsSync(fileName)) {
// Put the moduleName as relative to the main.ts.
result[moduleName] = fileName;
Expand Down