ts-loader: Thrown Errors have wrong line numbers
Expected Behaviour
any of the source-map options to tell me where errors actually happened (or throwed to be more exact)
Actual Behaviour
the lines on these error messages have some offset to their actual lines. sometimes printed line numbers are even higher than the actual LoC in the file.
tried the settings from README 1:1 and stuff like 'cheap-module-eval-source-map' and what-not as sourcemap, always an offset.
webpack.conf.js
const path = require('path');
const NodemonPlugin = require('nodemon-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
module.exports = {
target: 'node',
entry: './src/client/cli/CLIClient.ts',
devtool: 'cheap-module-eval-source-map',
module: {
rules: [
{
test: /\.(ts)$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.ts', '.js'],
alias: {
Assets: path.resolve(__dirname, 'assets/'),
Source: path.resolve(__dirname, 'src/')
}
},
output: {
filename: 'cli-client.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [new NodemonPlugin()],
externals: [nodeExternals()]
};
error output

BattleGen1.ts

About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 15 (3 by maintainers)
I believe it’s a ts-loader issue because it doesn’t happen with
awesome-typescript-loader. Unfortunately the latter is not maintained. Regards.I believe this is a webpack issue rather than a ts-loader one. If it is a ts-loader one then we’d happily welcome PRs that improve things!
@lukepolo could you try changing
devtool: hidden-source-maptodevtool: inline-source-mapto see if it helps?I’ll give it a go this morning as well , will make sure it works for us too