mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-25 08:41:39 +08:00
fix(routes): remove +
for non-lazy routes import (#499)
* fix(routes): remove `+` for non-lazy routes import - prepend `+` only for lazy routes' import path directories
This commit is contained in:
parent
e573295d1b
commit
555f1844bc
@ -17,7 +17,7 @@ module.exports = {
|
|||||||
{ name: 'inline-template', type: Boolean, default: false, aliases: ['it'] },
|
{ name: 'inline-template', type: Boolean, default: false, aliases: ['it'] },
|
||||||
{ name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }
|
{ name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }
|
||||||
],
|
],
|
||||||
|
|
||||||
beforeInstall: function(options) {
|
beforeInstall: function(options) {
|
||||||
options.route = true;
|
options.route = true;
|
||||||
if (options.lazy) {
|
if (options.lazy) {
|
||||||
@ -40,7 +40,7 @@ module.exports = {
|
|||||||
var parsedPath = dynamicPathParser(this.project, entityName);
|
var parsedPath = dynamicPathParser(this.project, entityName);
|
||||||
|
|
||||||
this.dynamicPath = parsedPath;
|
this.dynamicPath = parsedPath;
|
||||||
|
|
||||||
//leave the entity name intact for component generation
|
//leave the entity name intact for component generation
|
||||||
return entityName;
|
return entityName;
|
||||||
},
|
},
|
||||||
@ -115,7 +115,7 @@ module.exports = {
|
|||||||
|
|
||||||
// Insert the import statement.
|
// Insert the import statement.
|
||||||
let content = fs.readFileSync(parentFile, 'utf-8');
|
let content = fs.readFileSync(parentFile, 'utf-8');
|
||||||
const importTemplate = `import {${jsComponentName}Component} from './+${base}';`;
|
const importTemplate = `import {${jsComponentName}Component} from './${options.isLazyRoute ? '+' : ''}${base}';`;
|
||||||
|
|
||||||
if (content.indexOf(importTemplate) != -1) {
|
if (content.indexOf(importTemplate) != -1) {
|
||||||
// Already there, do nothing.
|
// Already there, do nothing.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user