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

Assets only works on top level project. #2507

Open
1 of 4 tasks
mkabatek opened this issue Feb 10, 2024 · 1 comment
Open
1 of 4 tasks

Assets only works on top level project. #2507

mkabatek opened this issue Feb 10, 2024 · 1 comment

Comments

@mkabatek
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

If I have a nest-cli.json like like below I can use the assets to get files from top level project. However If I want to store my assets along with a library it doesn't properly copy the assets/

  "collection": "@nestjs/schematics",
  "sourceRoot": "apps/api/src",
  "monorepo": true,
  "root": "apps/api",
  "compilerOptions": {
    "webpack": true,
    "tsConfigPath": "apps/api/tsconfig.app.json",
    "assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
  },
  "projects": {
    "api": {
      "type": "application",
      "root": "apps/api",
      "entryFile": "main",
      "sourceRoot": "apps/api/src",
      "compilerOptions": {
        "tsConfigPath": "apps/api/tsconfig.app.json"
      }
    },
    "jobs": {
      "type": "application",
      "root": "apps/jobs",
      "entryFile": "main",
      "sourceRoot": "apps/jobs/src",
      "compilerOptions": {
        "tsConfigPath": "apps/jobs/tsconfig.app.json"
      }
    },
    "persistence": {
      "type": "library",
      "root": "libs/persistence",
      "entryFile": "index",
      "sourceRoot": "libs/persistence/src",
      "compilerOptions": {
        "tsConfigPath": "libs/persistence/tsconfig.lib.json"
      }
    },

....

For example if I wanted to do this below, and put my assets with a library, the assets don't copy into the build directory.

  "collection": "@nestjs/schematics",
  "sourceRoot": "apps/api/src",
  "monorepo": true,
  "root": "apps/api",
  "compilerOptions": {
    "webpack": true,
    "tsConfigPath": "apps/api/tsconfig.app.json"
  },
  "projects": {
    "api": {
      "type": "application",
      "root": "apps/api",
      "entryFile": "main",
      "sourceRoot": "apps/api/src",
      "compilerOptions": {
        "tsConfigPath": "apps/api/tsconfig.app.json"
      }
    },
    "jobs": {
      "type": "application",
      "root": "apps/jobs",
      "entryFile": "main",
      "sourceRoot": "apps/jobs/src",
      "compilerOptions": {
        "tsConfigPath": "apps/jobs/tsconfig.app.json"
      }
    },
    "persistence": {
      "type": "library",
      "root": "libs/persistence",
      "entryFile": "index",
      "sourceRoot": "libs/persistence/src",
      "compilerOptions": {
        "tsConfigPath": "libs/persistence/tsconfig.lib.json"
        "assets": [{ "include": "**/*.html", "outDir": "dist/apps", "watchAssets": true }]
      }
    },

....

Minimum reproduction code

https://github.com/nestjs/nest-cli

Steps to reproduce

  1. Put assets in a library, and try to use the assets in the nest-cli.json

Expected behavior

The assets should be copied even if they are in a library.

Package version

9.4.2

NestJS version

9.4.2

Node.js version

v20.5.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@micalevisk
Copy link
Member

Please provide a minimum reproduction repository. You can start one by running npm init nest in your terminal

why reproductions are required

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