We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 806447e commit b11d560Copy full SHA for b11d560
packages/@angular/cli/blueprints/component/index.ts
@@ -231,7 +231,17 @@ export default Blueprint.extend({
231
path.relative(this.project.root, this.pathToModule));
232
return;
233
}
234
- const preChange = fs.readFileSync(this.pathToModule, 'utf8');
+
235
+ let preChange: any;
236
+ try {
237
+ preChange = fs.readFileSync(this.pathToModule, 'utf8');
238
+ } catch (err) {
239
+ if (err.code === 'EISDIR') {
240
+ throw 'Module specified should be a file, not a directory';
241
+ } else {
242
+ throw err;
243
+ }
244
245
246
returns.push(
247
astUtils.addDeclarationToModule(this.pathToModule, className, importPath)
0 commit comments