inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

Slack 클론 코딩[백엔드 with NestJS + TypeORM]

핫 리로딩 설정

핫리로딩으로 공식문서와 동일하게 적용했는데 찾을 수 없다고만 뜨는데 이유가 뭘까요??

해결된 질문

397

dev kim

작성한 질문수 12

0

핫리로딩으로 공식문서와 동일하게 적용했는데 찾을 수 없다고만 뜨는데 이유가 뭘까요??

아래 작성 코드 확인부탁드립니다!

 

PS C:\nestStudy\slack-clone-app\a-nest> npm run start:dev

> a-nest@0.0.1 start:dev
> nest build --webpack --webpackPath webpack-hmr.config.js --watch    


 Error  Cannot find module 'C:\nestStudy\slack-clone-app\a-nest\webpack-hmr.config.js'
Require stack:
- C:\nestStudy\slack-clone-app\a-nest\node_modules\@nestjs\cli\actions\build.action.js
- C:\nestStudy\slack-clone-app\a-nest\node_modules\@nestjs\cli\actions\index.js
- C:\nestStudy\slack-clone-app\a-nest\node_modules\@nestjs\cli\commands\command.loader.js
- C:\nestStudy\slack-clone-app\a-nest\node_modules\@nestjs\cli\commands\index.js
- C:\nestStudy\slack-clone-app\a-nest\node_modules\@nestjs\cli\bin\nest.js

 

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

declare const module: any;

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  const port = process.env.PORT || 3000;
  await app.listen(3000);
  console.log(`listening on port ${port}`);

  if (module.hot) {
    module.hot.accept();
    module.hot.dispose(() => app.close());
  }
}

bootstrap();

 

const nodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');

module.exports = function (options, webpack) {
  return {
    ...options,
    entry: ['webpack/hot/poll?100', options.entry],
    externals: [
      nodeExternals({
        allowlist: ['webpack/hot/poll?100'],
      }),
    ],
    plugins: [
      ...options.plugins,
      new webpack.HotModuleReplacementPlugin(),
      new webpack.WatchIgnorePlugin({
        paths: [/\.js$/, /\.d\.ts$/],
      }),
      new RunScriptWebpackPlugin({ name: options.output.filename, autoRestart: false }),
    ],
  };
};

 

{
  "name": "a-nest",
  "version": "0.0.1",
  "description": "",
  "author": "",
  "private": true,
  "license": "UNLICENSED",
  "scripts": {
    "build": "nest build",
    "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
    "start": "nest start",
    "start:dev-backup": "nest start --watch",
    "start:dev": "nest build --webpack --webpackPath webpack-hmr.config.js --watch",
    "start:debug": "nest start --debug --watch",
    "start:prod": "node dist/main",
    "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
    "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": "^10.0.0",
    "@nestjs/core": "^10.0.0",
    "@nestjs/platform-express": "^10.0.0",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^7.8.1"
  },
  "devDependencies": {
    "@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",
    "@typescript-eslint/eslint-plugin": "^5.59.11",
    "@typescript-eslint/parser": "^5.59.11",
    "eslint": "^8.42.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "jest": "^29.5.0",
    "prettier": "^2.8.8",
    "run-script-webpack-plugin": "^0.2.0",
    "source-map-support": "^0.5.21",
    "supertest": "^6.3.3",
    "ts-jest": "^29.1.0",
    "ts-loader": "^9.4.3",
    "ts-node": "^10.9.1",
    "tsconfig-paths": "^4.2.0",
    "typescript": "^5.1.3",
    "webpack": "^5.88.2",
    "webpack-node-externals": "^3.0.0"
  },
  "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 express nestjs typeorm

답변 1

1

제로초(조현영)

webpack-hmr.config.js가 a-nest 폴더 안에 존재하나요?

0

dev kim

안에 추가한 줄 알았는데 밖에 추가가 되있었습니다..! 감사합니다ㅠ

강의자료는 어디서 다운받나요?

0

116

4

질문 있습니다.

0

299

3

(강의 5:42 질문) providers를 통한 여러 개의 인스턴스 생성 & exports 통한 싱글톤 생성

0

154

2

코드 편집기 확장 프로그램

0

209

2

(질문)비밀 저장소에 접근하기 위한 인증 정보는 로컬 .env에 저장하는지?

0

147

2

(질문)외부 저장소를 통한 환경변수 불러오기 비동기 질문

0

170

3

로그인을 해도 LoggedInGuard쪽에서 false값이 나옵니다.

0

152

2

로그인방법이 고민됩니다.

0

191

2

yarn seed 명령어 실행 시 데이터 삽입 안됨

0

297

4

yarn run db:create 시에 발생하는 데코레이터 오류

0

242

2

npm run db:create 시에 발생하는 decorating 오류

0

233

2

RxJS 디버깅 질문 있습니다.

0

189

3

CacheManager에 대해 질문 있습니다.

0

175

2

로깅은 어떻게 하는게 효율적일까요?

0

224

1

CORS 질문 있습니다.

0

418

2

쿠키 옵션에 대해서 질문 있습니다.

0

184

2

로그아웃 요청이 403 forbidden 에러가 나는데 왜그런걸까요??

0

450

1

401 unauthorized문제

0

289

1

가드의 장점에 대해서 질문이 있습니다.

0

225

1

로그 관리에 대해 질문 있습니다.

0

252

2

CORS 에러 질문 있습니다.

0

319

2

배포 환경 DB 연결 질문 있습니다.

0

411

2

socket io 미 연결 문제 (nest & flutter)

1

1156

3

no elements in sequence 에러 관해서 질문이 있습니다.

0

454

1