Michal Ostruszka
Michal Ostruszka

Reputation: 2099

Webpack "devtool eval" doesn't show correct files content in devtools

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 command webpack-dev-server --inline --hot --port 9090 --content-base public/ --watch.

I read that it's recommended 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

enter image description here

Upvotes: 1

Views: 7244

Answers (1)

karolf
karolf

Reputation: 467

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              | 

Upvotes: 5

Related Questions