nestjs / nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
https://nestjs.com
MIT License
71.82k stars 7.95k forks source link

In monorepo mode, "nest start" cannot compile assets in non-root repos. #14971

Closed houjuan0623 closed 3 months ago

houjuan0623 commented 3 months ago

Is there an existing issue for this?

Current behavior

this is my nest-cli.json:

{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "apps/ocean.chat/src",
  "compilerOptions": {
    "deleteOutDir": true,
    "webpack": false,
    "assets": [
      {
        "include": "oceanchat_assets/**/*",
        "outDir": "dist/apps/ocean.chat/src"
      },
      {
        "include": "authorization_assets/**/*",
        "outDir": "dist/apps/authorization/src"
      }
    ]
  },
  "projects": {
    "account": {
      "type": "application",
      "root": "apps/account",
      "entryFile": "main",
      "sourceRoot": "apps/account/src",
      "compilerOptions": {
        "tsConfigPath": "apps/account/tsconfig.app.json"
      }
    },
    "authorization": {
      "type": "application",
      "root": "apps/authorization",
      "entryFile": "main",
      "sourceRoot": "apps/authorization/src",
      "compilerOptions": {
        "tsConfigPath": "apps/authorization/tsconfig.app.json"
      }
    },
    "i18n": {
      "type": "library",
      "root": "libs/i18n",
      "entryFile": "index",
      "sourceRoot": "libs/i18n/src",
      "compilerOptions": {
        "tsConfigPath": "libs/i18n/tsconfig.lib.json"
      }
    },
    "models": {
      "type": "library",
      "root": "libs/models",
      "entryFile": "index",
      "sourceRoot": "libs/models/src",
      "compilerOptions": {
        "tsConfigPath": "libs/models/tsconfig.lib.json"
      }
    },
    "ocean.chat": {
      "type": "application",
      "root": "apps/ocean.chat",
      "entryFile": "main",
      "sourceRoot": "apps/ocean.chat/src",
      "compilerOptions": {
        "tsConfigPath": "apps/ocean.chat/tsconfig.app.json"
      }
    },
    "settings": {
      "type": "library",
      "root": "libs/settings",
      "entryFile": "index",
      "sourceRoot": "libs/settings/src",
      "compilerOptions": {
        "tsConfigPath": "libs/settings/tsconfig.lib.json"
      }
    }
  },
  "monorepo": true,
  "root": "apps/ocean.chat"
}

this is my scripts in package.json:

"start": "nest start",
"start:dev": "concurrently \"yarn start:account\" \"yarn start:ocean.chat\" \"yarn start:authorization\"",

when I run yarn run start, I can't get authorization_assets under dist(the location of the compiled output file) folder: Image when I run yarn run start:dev, I can get authorization_assets under dist(the location of the compiled output file) folder:

Image

Minimum reproduction code

sorry, I can restore the environment.

Steps to reproduce

No response

Expected behavior

In monorepo mode, as long as I configure assets, I hope to be able to copy them normally.

Package

Other package

No response

NestJS version

No response

Packages versions

Node.js version

No response

In which operating systems have you tested?

Other

No response

kamilmysliwiec commented 3 months ago

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