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

On build, not all the assets configured are copied. #1828

Closed
2 of 4 tasks
greg-md opened this issue Nov 1, 2022 · 5 comments
Closed
2 of 4 tasks

On build, not all the assets configured are copied. #1828

greg-md opened this issue Nov 1, 2022 · 5 comments

Comments

@greg-md
Copy link
Contributor

greg-md commented Nov 1, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When you want to copy a big amount of assets on build, not all the files are copied to dist folder.

{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "assets": [
      {
        "include": "**/*.{js,css,ejs,html,json,less,png,svg,twig}",
        "watchAssets": true
      }
    ]
  }
}

The problem is because the assets manager kills the process after 1 second. See: https://github.com/nestjs/nest-cli/blob/master/lib/compiler/assets-manager.ts#L26

Minimum reproduction code

https://github.com/nestjs/nest-cli/blob/master/lib/compiler/assets-manager.ts#L26

Steps to reproduce

Try to copy a big amout of files, which would take more than 1 second and run nest build.

Expected behavior

It should copy all the files provided in the assets.

Package version

9.1.5

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

Setting a timeout before stopping the watcher will not work. There should be found other ways of doing it.

I see that chokidar have a ready event for when it completes the first scan, which could be used in non watching mode.

.on('ready', () => log('Initial scan complete. Ready for changes'))

So the fix would be like:

.on('ready', () => !isWatchEnabled && watcher.close())
@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

@greg-md
Copy link
Contributor Author

greg-md commented Nov 3, 2022

@kamilmysliwiec Done. #1829

@greg-md
Copy link
Contributor Author

greg-md commented Nov 8, 2022

@kamilmysliwiec do you have an estimation date when this will get merged & released? Because currently we are blocked by this issue.

@kamilmysliwiec
Copy link
Member

Let's track this here #1829

@greg-md
Copy link
Contributor Author

greg-md commented Mar 31, 2023

@kamilmysliwiec how about this issue? Is it going to be fixed properly?

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

No branches or pull requests

2 participants