Mic*_*zka 1 javascript reactjs webpack
我有相对简单的webpack配置文件(如下):
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/
}
]
}
};
Run Code Online (Sandbox Code Playgroud)
我正在使用webpack-dev-server以下命令在开发中使用应用程序webpack-dev-server --inline --hot --port 9090 --content-base public/ --watch.
我读到eval在开发时建议使用源地图,但它对我不起作用.我在我的devtools中获得的内容如下.它正确显示文件(main.js和hello.js)但它包含babel-transiled内容,而不是原始内容.当我把它设置为eval-source-map它工作正常.
我的设置有什么问题?此处提供了此问题的完整项目
有关每个源映射设置的详细信息,请查看官方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 |
Run Code Online (Sandbox Code Playgroud)