Webpack" devtool eval"没有在devtools中显示正确的文件内容

时间:2015-09-18 07:30:43

标签: javascript reactjs webpack

我有相对简单的webpack配置文件(如下):

 List < Signal > collection = new List < Signal > ();
 collection.AddRange((new[] 
 {
    new Signal
    {
        Name = "Hello",
        Value = 1,
        rawValue = new ObservableCollection < RawVal > ((new[] {
            new RawVal { name = "A", value = 1}, 
            new RawVal {name = "B", value = 1}
        }).ToList()),
    },
    new Signal {
        Name = "World",
        Value = 2,
        rawValue = new ObservableCollection < RawVal > ((new[] {
            new RawVal {name = "A", value = 1}, 
            new RawVal {name = "B", value = 1}
        }).ToList()),
    }
 }).ToList());

 this.DataContext = collection;

我使用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/ } ] } }; 在使用以下命令webpack-dev-server进行开发时为应用提供服务。

我读到它建议在开发时使用webpack-dev-server --inline --hot --port 9090 --content-base public/ --watch作为源地图,但它对我不起作用。我在我的devtools中获得的内容如下。它正确显示文件(evalmain.js),但它包含babel-transiled内容,而不是原始内容。当我将其设置为hello.js时,它可以正常工作。

我的设置有什么问题?此问题的完整项目可用here

enter image description here

1 个答案:

答案 0 :(得分:5)

请查看官方Webpack文档,了解每个源地图设置的详细信息 - http://webpack.github.io/docs/configuration.html#devtool

如果您想要原始行(未编译),请使用文档表中列出的选项。

| 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              |