#Using SWC compiler has wrong paths

3 messages · Page 1 of 1 (latest)

teal vessel
#

Hello,
I have the following structure in my app:
.
..
src <= nestJS Folder
shared <= a folder shared by my frontend and my backend

When using tsc as builder, in my dist folder two folders are created:
src, and shared, just as expected.
However, when using swc, the shared folder is ignored, and my dist folder only contains the content of src
Do you have any idea on how I could fix that?

My tsconfig.json:

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "declaration": false,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": false,
    "importHelpers": true,
    "incremental": true,
    "lib": ["es2021"],
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "./dist",
    "paths": {
      "@myapp/shared": ["shared/src"],
      "@myapp/*": ["src/libs/*"]
    },
    "removeComments": true,
    "resolveJsonModule": true,
    "rootDir": ".",
    "skipDefaultLibCheck": true,
    "skipLibCheck": true,
    "strictPropertyInitialization": false,
    "sourceMap": true,
    "strict": true,
    "target": "es2015"
  }
}

My nest-cli.json

{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "root": "src",
  "compilerOptions": {
    "builder": { "type": "tsc", "options": { "copyFiles": true } },
    "assets": ["./shared"]
  }
}

Thanks for your help ☃️

lean moss
#

Hello! I came to the nest discord to ask this exact same question... sad it wasn't answered yet 😦 have you found a solution for this @teal vessel?

teal vessel
#

Not really, I ended up moving the shared inside src!