最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Webpack "devtool eval" doesn't show correct files content in devtools - Stack Overflow

programmeradmin0浏览0评论

I'm having relatively simple webpack config file (below):

module.exports = {
    entry: "./src/main.js",
    output: {
        filename: "bundle.js"
    },
  devtool: "eval",
    module: {
    loaders: [
      {
        test: /\.css$/, loader: "style!css",
        exclude: /node_modules/,
      },
      { 
        test   : /.js$/,
        loader : 'babel-loader' ,
        exclude: /node_modules/
      }
    ]
  }
};

I'm using webpack-dev-server to serve an app when in development with the following mand webpack-dev-server --inline --hot --port 9090 --content-base public/ --watch.

I read that it's remended using eval for source maps when in development, but it doesn't work for me. What I get in my devtools is as follows. It correctly shows files (main.js and hello.js) but it contains babel-transpiled content, not the original one. When I set it to eval-source-map it works fine.

What's wrong in my setup? Complete project for this question is available here

I'm having relatively simple webpack config file (below):

module.exports = {
    entry: "./src/main.js",
    output: {
        filename: "bundle.js"
    },
  devtool: "eval",
    module: {
    loaders: [
      {
        test: /\.css$/, loader: "style!css",
        exclude: /node_modules/,
      },
      { 
        test   : /.js$/,
        loader : 'babel-loader' ,
        exclude: /node_modules/
      }
    ]
  }
};

I'm using webpack-dev-server to serve an app when in development with the following mand webpack-dev-server --inline --hot --port 9090 --content-base public/ --watch.

I read that it's remended using eval for source maps when in development, but it doesn't work for me. What I get in my devtools is as follows. It correctly shows files (main.js and hello.js) but it contains babel-transpiled content, not the original one. When I set it to eval-source-map it works fine.

What's wrong in my setup? Complete project for this question is available here

Share Improve this question edited Sep 18, 2015 at 8:07 Michal Ostruszka asked Sep 18, 2015 at 7:30 Michal OstruszkaMichal Ostruszka 2,0992 gold badges21 silver badges24 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

Please check official Webpack documentation for details of every Source Maps setting - http://webpack.github.io/docs/configuration.html#devtool.

If you want original lines (not transpiled) use options listed in documentation table.

| Devtool                       | Quality                      |
| ----------------------------- | ---------------------------- |
| cheap-module-eval-source-map  | original source (lines only) |                  
| ----------------------------- | ---------------------------- |
| cheap-module-source-map       | original source (lines only) |                   
| ----------------------------- | ---------------------------- |
| eval-source-map               | original source              | 
| ----------------------------- | ---------------------------- |
| source-map                    | original source              | 
发布评论

评论列表(0)

  1. 暂无评论