Skip to content

swc tsCompiler does not seem to do anything #46

Closed

Description

@EdwardKerckhof

Steps taken:

  1. Create fresh nestjs application
  2. Add @swc/core to dev dependencies
  3. Create vite.config.ts
  4. Update src/main.ts

Error:
image

vite.config.ts
image

src/main.ts
image

When removing the tsCompiler option I get the same error, but I was under the impression swc would fix reflect-metadata doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.

package.json:

{
  "name": "api",
  "version": "1.0.0",
  "private": true,
  "license": "MIT",
  "scripts": {
    "prebuild": "rimraf dist",
    "build": "vite build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "dev": "vite",
    "start": "nest start",
    "start:dev": "nest start --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "test": "vitest",
    "test:watch": "vitest --watch",
    "test:cov": "vitest --coverage"
  },
  "dependencies": {
    "@nestjs/common": "^8.0.0",
    "@nestjs/core": "^8.0.0",
    "@nestjs/platform-express": "^8.0.0",
    "class-transformer": "^0.5.1",
    "class-validator": "^0.13.2",
    "reflect-metadata": "^0.1.13",
    "rimraf": "^3.0.2",
    "rxjs": "^7.2.0"
  },
  "devDependencies": {
    "@nestjs/cli": "^8.0.0",
    "@nestjs/schematics": "^8.0.0",
    "@nestjs/testing": "^8.0.0",
    "@swc/core": "^1.2.187",
    "@types/express": "^4.17.13",
    "@types/node": "^16.0.0",
    "@types/supertest": "^2.0.11",
    "config": "workspace:*",
    "source-map-support": "^0.5.20",
    "supertest": "^6.1.3",
    "ts-loader": "^9.2.3",
    "ts-node": "^10.0.0",
    "tsconfig": "workspace:*",
    "tsconfig-paths": "^3.10.1",
    "typescript": "^4.3.5",
    "vite": "^2.9.9",
    "vite-plugin-node": "^0.0.19"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".*\\.spec\\.ts$",
    "transform": {
      "^.+\\.(t|j)s$": "vitest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }
}

Activity

  1. EdwardKerckhof commented on May 20, 2022

    @EdwardKerckhof
    Author

    Does not give breaking issues.

  2. sebastiangug commented on Jul 1, 2022

    @sebastiangug

    @EdwardKerckhof what was the solution for this? currently facing the same problem.

  3. Simolation commented on Mar 24, 2023

    @Simolation

    I have the same issue. How did you resolve it?

  4. SymphonyIceAttack commented on Apr 2, 2023

    @SymphonyIceAttack

    I have sent a PR for this issue which can loging the message about which file update

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions