我在这里做错了什么?
运行webpack -d --config webpack.config.js
捆绑文件时不要创建映射文件。
webpack.config.js
const path = require('path');
module.exports = {
mode: "development",
devtool: "inline-source-map",
entry: './server/server.ts',
output: {
filename: 'server.js',
path: path.resolve(__dirname, 'dist')
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
target: 'node',
node: {
console: true,
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};
tsconfig.json
{
"files": [
"server/server.ts"
],
"include": [
"server/**/*.ts"
],
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"target": "es6",
"outDir": "dist",
"rootDir": "server",
"sourceMap": true,
"baseUrl": ".",
"moduleResolution": "node",
"removeComments": true,
"typeRoots": [ "node_modules/@types" ],
"paths": {
"*": [
"node_modules/@types/*",
"./server/types/*"
]
}
}
}
server.js 被创建,但缺少地图文件。每次我运行webpack -d --config webpack.config.js
地图文件都不会被创建。
版本:
网络包 4.5.0
tsloader 4.2.0