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
66.86k stars 7.55k forks source link

cannot run debugger with custom webpack config #13212

Closed surajsharma closed 7 months ago

surajsharma commented 7 months ago

Is there an existing issue for this?

Current behavior

using vscode, trying to run

nest start --debug --watch --webpack --webpackPath webpack.config.ts

produces:


Debugger listening on ws://127.0.0.1:60469/5d477ac3-4b71-4b8b-8df0-90fd2d92dcb9
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

Error  Cannot use import statement outside a module

any way i can keep the debugger running with a custom webpack config?

Minimum reproduction code

https://github.com/async3619/cruise/blob/dev/apps/main/webpack.config.ts

Steps to reproduce

No response

Expected behavior

the attached debugger should work

Package

Other package

No response

NestJS version

10.0.0

Packages versions

{
    "name": "main",
    "version": "0.0.1",
    "description": "",
    "author": "",
    "main": "dist/main.js",
    "private": true,
    "license": "UNLICENSED",
    "scripts": {
        "build": "rimraf ./dist && webpack --config ./webpack.config.ts",
        "debug": "nest start --debug --watch --webpack --webpackPath webpack.config.ts",
        "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
        "test": "jest",
        "e2e": "jest --config ./test/jest-e2e.json",
        "rebuild": "electron-rebuild"
    },
    "dependencies": {
        "@nestjs/apollo": "^12.0.7",
        "@nestjs/common": "^10.0.0",
        "@nestjs/core": "^10.0.0",
        "@nestjs/graphql": "^12.0.8",
        "@nestjs/platform-express": "^10.0.0",
        "fs-extra": "^11.1.1",
        "get-port": "^5.1.1",
        "graphql": "^16.8.0",
        "graphql-subscriptions": "^2.0.0",
        "iterall": "^1.3.0",
        "reflect-metadata": "^0.1.13",
        "rxjs": "^7.8.1",
        "typeorm": "^0.3.20",
        "zen-observable": "^0.10.0",
        "zod": "^3.22.4"
    },
    "devDependencies": {
        "@apollo/client": "^3.8.1",
        "@apollo/server": "^4.9.1",
        "@as-integrations/fastify": "^2.1.0",
        "@electron-toolkit/utils": "^2.0.0",
        "@nestjs/cli": "^10.0.0",
        "@nestjs/schematics": "^10.0.0",
        "@nestjs/testing": "^10.0.0",
        "@types/express": "^4.17.17",
        "@types/jest": "^29.5.2",
        "@types/node": "^20.3.1",
        "@types/supertest": "^2.0.12",
        "@types/webpack-bundle-analyzer": "^4.6.0",
        "@types/zen-observable": "^0.8.3",
        "electron": "^25.5.0",
        "eslint": "^8.42.0",
        "jest": "^29.5.0",
        "rimraf": "^5.0.1",
        "run-script-webpack-plugin": "^0.2.0",
        "source-map-support": "^0.5.21",
        "supertest": "^6.3.3",
        "terser-webpack-plugin": "^5.3.9",
        "ts-jest": "^29.1.0",
        "ts-loader": "^9.4.3",
        "ts-node": "^10.9.1",
        "tsconfig": "workspace:*",
        "tsconfig-paths": "^4.2.0",
        "tsconfig-paths-webpack-plugin": "^4.1.0",
        "types": "workspace:*",
        "typescript": "^5.1.3",
        "utils": "workspace:*",
        "webpack": "^5.88.2",
        "webpack-bundle-analyzer": "^4.9.0",
        "webpack-cli": "^5.1.4"
    },
    "jest": {
        "moduleFileExtensions": [
            "js",
            "json",
            "ts"
        ],
        "rootDir": "src",
        "testRegex": ".*\\.spec\\.ts$",
        "transform": {
            "^.+\\.(t|j)s$": "ts-jest"
        },
        "collectCoverageFrom": [
            "**/*.(t|j)s"
        ],
        "coverageDirectory": "../coverage",
        "testEnvironment": "node"
    }
}

Node.js version

No response

In which operating systems have you tested?

Other

No response

kamilmysliwiec commented 7 months ago

Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the #ā  šŸˆ nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.