Webpack 中 Typescript 的源映射(使用 webpack-dev-server 时看不到源映射)

Source maps for Typescript in Webpack (can't see source maps when using webpack-dev-server)

我正在尝试使用 Typescript (awesome-typescript-loader (link)) together with Webpack, but I don't see source maps in browser when running webpack-dev-server. The same setup worked with babel-loader (link) 和 ES6 类(我可以在浏览器中调试 ES6 类,即使它们被编译成ES5)

我的 Webpack 配置文件看起来像(这是重要的片段,完整版本在 github):

module.exports = {
    resolve: {
        extensions: ['', '.ts', '.js']
    },
    entry: {
        app: './src/app.ts'
    },
    output: {
        path: params.output.path,
        filename: params.output.filename
    },
    module: {
        loaders: [
            {test: /\.ts$/, loader: 'awesome-typescript', exclude: /node_modules/},
            {test: /\.css$/, loader: 'style!css'}
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html',
            inject: 'body'
        })
    ].concat(params.plugins),
    progress: true,
    colors: true,
    devServer: {
        port: params.server.port
    }
};

我发现了问题,我提取了 devtooldebug 属性作为参数,但我忘记再次阅读它们以进行最终配置。最终的工作版本如下所示:

// ...
debug: params.debug,
devtool: params.devtool,
// ...