midwayjs / midway

🍔 A Node.js Serverless Framework for front-end/full-stack developers. Build the application for next decade. Works on AWS, Alibaba Cloud, Tencent Cloud and traditional VM/Container. Super easy integrate with React and Vue. 🌈
https://www.midwayjs.org/
MIT License
7.34k stars 573 forks source link

升级到2.0后修改文件不会触发reload #693

Closed wenchao0809 closed 3 years ago

wenchao0809 commented 3 years ago

基于midway-init创建得1.0版本修改文件可以正常触发reload,我自己手动升级到2.3.21后无法触发reload

config.local.ts

import { EggAppConfig, EggAppInfo, PowerPartial } from 'midway';
export type DefaultConfig = PowerPartial<EggAppConfig>

export default  (appInfo: EggAppInfo) => {
  const config = {} as DefaultConfig;
  config.development = {
    watchDirs: [
      'app',
      'lib',
      'service',
      'config',
      'app.ts',
      'agent.ts',
      'interface.ts',
    ],
    overrideDefault: true,
  }
  config.sequelize = {
    dialect: 'mssql', // support: mysql, mariadb, postgres, mssql
    host: 'localhost',
    port: '1443',
    database: 'fudan_cancer',
    username: 'SA',
    password: 'Bottle200',
  }
  return config;
};
czy88840616 commented 3 years ago

midway2的 reload 能力是是由 @midwayjs/cli 带来的,确认下是否删除了老的 midway-bin 模块。

wenchao0809 commented 3 years ago

midway2的 reload 能力是是由 @midwayjs/cli 带来的,确认下是否删除了老的 midway-bin 模块。

我把midway-bin升级到最新版本还是不行这是我的package.json

{
  "name": "fudan-cancer-backend",
  "version": "1.0.0",
  "description": "{{description}}",
  "private": true,
  "dependencies": {
    "egg-scripts": "^2.13.0",
    "midway": "^2.3.21",
    "mssql": "^6.2.3",
    "mysql2": "^2.2.5",
    "sequelize": "6.3.5"
  },
  "devDependencies": {
    "@types/mocha": "^8.0.3",
    "@types/node": "^14.14.6",
    "cross-env": "^7.0.2",
    "egg-ci": "^1.18.0",
    "midway-bin": "^2.2.4",
    "midway-mock": "^2.1.4",
    "tslib": "^1.8.1",
    "tslint-midway-contrib": "^1.20.1",
    "ts-node": "^9.0.0",
    "tslint": "^6.1.3",
    "typescript": "^4.0.5"
  },
  "engines": {
    "node": ">=10.16.0"
  },
  "scripts": {
    "start": "egg-scripts start --daemon --title=midway-server-fudan-cancer-backend --framework=midway --ts",
    "stop": "egg-scripts stop --title=midway-server-fudan-cancer-backend",
    "start_build": "npm run build && cross-env NODE_ENV=development  dev",
    "clean": "midway-bin clean",
    "dev": "cross-env NODE_ENV=local midway-bin dev --ts",
    "debug": "cross-env NODE_ENV=local midway-bin debug --ts",
    "test": "npm run lint && midway-bin test --ts",
    "cov": "midway-bin cov --ts",
    "lint": "tslint --fix -p tsconfig.json -t stylish",
    "ci": "npm run cov",
    "build": "midway-bin build -c",
    "autod": "midway-bin autod"
  },
  "ci": {
    "version": "10"
  },
  "midway-bin-clean": [
    ".vscode/.tsbuildinfo",
    "dist"
  ],
  "repository": {
    "type": "git",
    "url": ""
  },
  "author": "anonymous",
  "license": "MIT"
}
wenchao0809 commented 3 years ago

midway2的 reload 能力是是由 @midwayjs/cli 带来的,确认下是否删除了老的 midway-bin 模块。 使用 @midwayjs/cli创建项目是ok的, 我昨天一直看的官网V1的文档。。。。

czy88840616 commented 3 years ago

@ET912 https://www.yuque.com/midwayjs/midway_v2/v1_upgrade_v2#KMf23 我们有升级文档,我加了一条,把midway-bin 替换为 @midwayjs/cli