Skip to content
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

Save some recompile time with nest start --watch by enabling cache on webpack #1318

Closed
ajubin opened this issue Sep 1, 2021 · 3 comments
Closed

Comments

@ajubin
Copy link
Contributor

ajubin commented Sep 1, 2021

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

When starting nest in watch mode nest start --watch, every change on a single source file recompile the entire project.

With some measurement, it takes about 7.5 sec for my project

Expected behavior

Webpack should recompile only the changed files thanks to cache: true or mode: 'development' in default webpack config.

Documentation:

By setting one of these options, on my project, recompile time drops from 7.5s to less than 1s

I'm open to do a Pull Request, but i'm not sure about the strategy.

I think we should change

to development by adding another variable in the webpackDefaultFactory

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

It will save up some time for everyone using nest in watch mode

Environment


[System Information]
OS Version     : macOS
NodeJS Version : v14.17.1
YARN Version    : 1.22.10 

[Nest CLI]
Nest CLI Version : 7.5.4 

[Nest Platform Information]
platform-express version : 7.6.12
terminus version         : 7.1.2
swagger version          : 4.7.12
typeorm version          : 7.1.5
common version           : 7.6.12
config version           : 1.0.1
bull version             : 0.3.1
core version             : 7.6.15
cqrs version             : 7.0.1
@kamilmysliwiec
Copy link
Member

I think adding mode: 'development' here https://github.com/nestjs/nest-cli/blob/master/lib/compiler/webpack-compiler.ts#L71-L74 only if watchMode || webpackConfiguration.watch should be sufficient :) Would you like to create PR for this issue?

@ajubin
Copy link
Contributor Author

ajubin commented Sep 1, 2021

Yes I can do that :) I will be happy to contribute

@kamilmysliwiec
Copy link
Member

Let's track this here #1319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants