简体   繁体   中英

Webpack 4 and ts-loader not generating map files

What am I doing wrong here?

When running webpack -d --config webpack.config.js bundle files do not create map file.

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 gets created, but missing the map file. Everytime I run webpack -d --config webpack.config.js map files are not being created.

versions:

webpack 4.5.0

tsloader 4.2.0

devtool is set to inline-source-map ; thus your source maps are included as a comment inline in the JS files. If you want to produce a separate map file, change devtool to sourcemap .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM