Webpack不会根据打字稿模型文件中的更改重新编译

时间:2019-05-16 16:02:39

标签: javascript typescript npm webpack webpack-4

重现此问题的步骤:

  • 克隆repo,运行npm installnpm run start
  • test.model.ts文件取消注释行5内

    结果,webpack的日志中没有显示错误,而是这样的:

    「atl」: Checking started in a separate process... 「atl」: Time: 1ms

  • 更改此文件内的其他任何内容(例如:在文件末尾添加新的空行)

    因此,webpack将显示它以前应该显示的错误:

    ✖ 「atl」: Checking finished with 1 errors

这是我的package.json文件:

{
  "name": "webpack-watch-ts-debug",
  "version": "1.0.0",
  "description": "",
  "main": "dist/main.js",
  "scripts": {
    "start": "webpack"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "awesome-typescript-loader": "5.2.1",
    "typescript": "3.4.4",
    "webpack": "4.30.0",
    "webpack-cli": "3.3.0"
  }
}

我的webpack配置:

const path = require('path');

module.exports = {
    mode: 'development',

    entry: {
        main: './src/index.ts'
    },

    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist')
    },

    resolve: {
        extensions: ['.ts', '.js']
    },

    module: {
        rules: [
            {
                test: /\.ts$/,
                use: ['awesome-typescript-loader'],
                exclude: /node_modules/
            }
        ]
    },

    stats: {
        errorDetails: true
    },

    watch: true
};

这是一个小问题,但仍然有些烦人。我究竟做错了什么?是什么引起了这个问题(我不确定是webpack,虽然我不确定)?

0 个答案:

没有答案