webpack连接hotreload后nestjs渲染报错

nestjs rendering error after connecting webpack with hotreload

我已经按照 nestJs 的教程进行操作,并且有一个基本的工作应用程序。之后,我尝试了教程将我的应用程序与 webpack 和 hotreloading 连接起来,现在出现以下错误:

import { Entity, Column, PrimaryGeneratedColumn } from 'typeorm';
SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:703:23)

我已经尝试查看类似的错误,但除了在我的测试文件中未编译的地方的提示之外找不到任何结论 - 任何方向将不胜感激。

使用节点 12,npm 6.9.0

包裹 JSON 以下:

"scripts": {
    "build": "tsc -p tsconfig.build.json",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "node dist/server",
    "webpack": "webpack --config webpack.config.js",
    "start:dev": "concurrently --handle-input \"wait-on dist/main.js && nodemon\" \"tsc -w -p tsconfig.build.json\" ",
    "start:debug": "nodemon --config nodemon-debug.json",
    "prestart:prod": "rimraf dist && npm run build",
    "start:prod": "node dist/main.js",
    "lint": "tslint -p tsconfig.json -c tslint.json",
    "test": "jest",
    "test:watch": "jest --watch",
    "test:cov": "jest --coverage",
    "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
    "test:e2e": "jest --config ./test/jest-e2e.json"
  },
  "dependencies": {
    "@nestjs/common": "^6.0.4",
    "@nestjs/core": "^6.0.4",
    "@nestjs/microservices": "^6.0.4",
    "@nestjs/platform-express": "^6.0.4",
    "@nestjs/swagger": "^3.0.2",
    "@nestjs/typeorm": "^6.1.1",
    "@nestjs/websockets": "^6.0.4",
    "mysql": "^2.17.1",
    "reflect-metadata": "0.1.13",
    "rimraf": "2.6.3",
    "rxjs": "6.4.0",
    "swagger-ui-express": "^4.0.4",
    "typeorm": "^0.2.17"
  },
  "devDependencies": {
    "@nestjs/testing": "6.1.1",
    "@types/express": "^4.16.1",
    "@types/jest": "24.0.11",
    "@types/node": "11.13.4",
    "@types/supertest": "2.0.7",
    "concurrently": "^4.1.0",
    "jest": "24.7.1",
    "nodemon": "1.18.11",
    "prettier": "1.17.0",
    "supertest": "4.0.2",
    "ts-jest": "24.0.2",
    "ts-loader": "^6.0.1",
    "ts-node": "8.1.0",
    "tsconfig-paths": "3.8.0",
    "tslint": "5.16.0",
    "typescript": "3.4.3",
    "wait-on": "^3.2.0",
    "webpack": "^4.32.2",
    "webpack-cli": "^3.3.2",
    "webpack-node-externals": "^1.7.2"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "json",
      "ts"
    ],
    "rootDir": "src",
    "testRegex": ".spec.ts$",
    "transform": {
      "^.+\.(t|j)s$": "ts-jest"
    },
    "collectCoverageFrom": [
      "**/*.(t|j)s"
    ],
    "coverageDirectory": "../coverage",
    "testEnvironment": "node"
  }

这可能是 tsconfig,您使用的是: "module": "commonjs"compilerOptions 中?当你使用 nodejs 时,这是你必须使用的选项

我终于在 NestJS 存储库上发布了这个,并收到了感兴趣的人的回复: https://github.com/nestjs/nest/issues/2389