[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Generator Errors
when i tried to run
$ nest g mo app/advertisement
the result of this command is OK!
CREATE /src/app/advertisement/advertisement.module.ts (90 bytes)
UPDATE /src/app/app.module.ts (1963 bytes)
But !
Before:

After:

To add imports in correct place.
create a new nest project
add some imports in the file app.module.ts - _the root module_ - in that way
import {
ModuleA,
ModuleB,
ModuleC
} from './modules'
then try to generate new module
I think the problem that nest-cli only matches the last import import {
and start adding the new import in the new line, but it should also matches the } at the end of that line and the new lines
$ nest info
[System Information]
OS Version : Linux 4.18
NodeJS Version : v10.10.0
NPM Version : 6.4.1
[Nest Information]
websockets version : 5.3.11
mongoose version : 5.2.2
swagger version : 2.5.1
typeorm version : 5.2.2
common version : 5.3.11
core version : 5.3.11
Hey @shekohex,
I'm trying to reproduce your issue. Do you still face this issue? (after latest updates)
Hi Kamil,
unfortunately, Yes
$ nest g mo app/user-transactions2
CREATE /src/app/user-transactions2/user-transactions2.module.ts (94 bytes)
UPDATE /src/app/app.module.ts (2359 bytes)

nestjs/cli v5.6.2
$ nest info
[System Information]
OS Version : Linux 4.18
NodeJS Version : v10.10.0
NPM Version : 6.4.1
[Nest Information]
websockets version : 5.3.11
mongoose version : 5.2.2
swagger version : 2.5.1
typeorm version : 5.2.2
common version : 5.3.11
core version : 5.3.11
Could you share a small repo so I can reproduce this issue locally?
Here we go
https://github.com/shekohex/module-import-test
try to add new module
$ nest g mo module8
and see the main module
Thanks @shekohex. Looks like we have to update underlying @angular-devkit/schematics engine :) I'll do it soon
Fixed in 5.7.0. Thanks for reporting! 馃挭
Most helpful comment
Thanks @shekohex. Looks like we have to update underlying
@angular-devkit/schematicsengine :) I'll do it soon