2015-09-18 41 views
1

我在(下)比較簡單的WebPack配置文件:的WebPack「devtool EVAL」不顯示在devtools正確的文件內容

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

我讀到它建議在開發時使用eval作爲源地圖,但它不適用於我。我在我的devtools中得到如下。它正確顯示文件(main.jshello.js),但它包含babel轉錄的內容,而不是原始文件。當我將它設置爲eval-source-map它工作正常。

我的設置有什麼問題?對於這個問題,整個項目可here

enter image description here

回答

3

請查看官方的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    | 
+1

是。顯然我很難把握這張桌子(尤其是質量欄目)。感謝提示。 –

+0

僅由鏈接組成的答案通常被認爲是SO上的不良做法。請考慮擴大您的答案。 http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers – Chris

+0

@Chris用適當的選項添加了桌子 – karolf