2017-04-14 108 views
0

我正在调试chavas中的javascrip代码,但chrome不让我在需要的位置放置断点。我点击放置断点,然后在点击行之前或之后放一些行。无法在javascript上放置断点

我点击了线94,并且他把断裂的管线96

the code in chrome

我该怎么办调试呢? 请帮忙。

下这里是webpack.config.development.js

import path from 'path'; 
import webpack from 'webpack'; 
import validate from 'webpack-validator'; 
import merge from 'webpack-merge'; 
import formatter from 'eslint-formatter-pretty'; 
import baseConfig from './webpack.config.base'; 

const port = process.env.PORT || 3000; 

export default validate(merge(baseConfig, { 
    debug: true, 

    devtool: 'eval-source-map', 

    entry: [ 
    `webpack-hot-middleware/client? 
path=http://localhost:${port}/__webpack_hmr`, 
    'babel-polyfill', 
    './app/styles/main.less', 
    './app/index' 
    ], 

    output: { 
    publicPath: `http://localhost:${port}/dist/` 
    }, 

    resolve: { 
    fallback: path.join(__dirname, 'node_modules') 
    }, 

    resolveLoader: { fallback: path.join(__dirname, 'node_modules') }, 

    module: { 
    loaders: [ 
     { 
     test: /\.(less|scss)$/, 
     loader: 'style!css!autoprefixer!less' 
     }, 

     // Load images 
     { test: /\.jpg/, loader: 'url-loader?limit=10000&mimetype=image/jpg' }, 
     { test: /\.gif/, loader: 'url-loader?limit=10000&mimetype=image/gif' }, 
     { test: /\.png/, loader: 'url-loader?limit=10000&mimetype=image/png' }, 
     { test: /\.svg/, loader: 'url-loader?limit=10000&mimetype=image/svg' }, 

     // Load fonts 
     { test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url-loader? 
limit=10000&mimetype=application/font-woff' }, 
     { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file- 
loader' }, 
    ] 
    }, 

    eslint: { 
    formatter 
    }, 

    plugins: [ 
    // https://webpack.github.io/docs/hot-module-replacement-with-webpack.html 
    new webpack.HotModuleReplacementPlugin(), 

    // “If you are using the CLI, the webpack process will not exit with an error code by enabling this plugin.” 
    // https://github.com/webpack/docs/wiki/list-of-plugins#noerrorsplugin 
    new webpack.NoErrorsPlugin(), 

    // NODE_ENV should be production so that modules do not perform certain development checks 
    new webpack.DefinePlugin({ 
     'process.env.NODE_ENV': JSON.stringify('development') 
    }) 

    ], 

    // https://github.com/chentsulin/webpack-target-electron-renderer#how- 
this-module-works 
    target: 'electron-renderer' 
})); 
+0

如果你的源地图确定,这很可能是Chrome DevTools的一个问题...... – Badacadabra

回答

0

使用debugger;声明在你的代码,你想让它暂停,如果你知道你想要把断点运行的代码之前。

确保控制台在调试之前处于打开状态,否则断点将被禁用。

+0

我已经把调试器;在函数开始的声明,但行为仍然相同,不让我把我想要的休息。 – DudeBnu

+0

我有调试器的想法;声明now.better然后什么都没有。 – DudeBnu