首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Webpack 4和ts-loader不生成地图文件

Webpack 4和ts-loader不生成地图文件
EN

Stack Overflow用户
提问于 2018-04-10 06:43:42
回答 1查看 1.5K关注 0票数 0

我在这里做错了什么?

运行webpack -d --config webpack.config.js包文件时,请不要创建映射文件。

webpack.config.js

代码语言:javascript
复制
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

代码语言:javascript
复制
{
  "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映射文件都不会被创建。

版本:

webpack 4.5.0

tsloader 4.2.0

EN

回答 1

Stack Overflow用户

发布于 2018-04-10 08:48:43

devtool设置为inline-source-map;因此,您的源图将作为内联注释包含在JS文件中。如果要生成单独的映射文件,请将devtool更改为sourcemap

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49742751

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档