我对源 Map 有问题 . 它们已生成但显然未使用 . 我使用webpack-dev-server,反应热模块替换和Webpack v3.x,如果这很重要的话 . 在我的webpack-config里面,我使用devtool:'source-map',我运行我的脚本,如下所示:

"webpack": "cross-env NODE_ENV=development webpack-dev-server -d --config webpack.config.js"

我得到的错误示例

enter image description here

当我点击这个客户端?e36c:157它不需要我的源代码,但是:

enter image description here

如果我从webpack.config中删除devtools并从脚本中删除-d标记,我会得到相同的输出

**webpack.config.js**

const path = require('path')
const webpack = require('webpack')

const publicPath = path.resolve(__dirname, './src/client')
const buildPath = path.resolve(__dirname, './src')
// const BrowserSyncPlugin = require('browser-sync-webpack-plugin')
const Write = require('write-file-webpack-plugin')

process.noDeprecation = true

module.exports = {
  devtool: 'source-map',
  performance: {
    hints: false,
  },
  devServer: {
    hot: true,
    port: 3001,
    host: 'localhost',
    /* Needed only if using Browsersync */
    headers: { 'Access-Control-Allow-Origin': '*', },
    proxy: {
      '**': {
        target: 'http://localhost:3000',
        secure: false,
        changeOrigin: true,
      },
    },
  },
  context: publicPath,
  entry: {
    bundle: [
      'react-hot-loader/patch',
      'webpack-dev-server/client?http://localhost:3001',
      'webpack/hot/only-dev-server',
      'script-loader!jquery/dist/jquery.min.js',
      'script-loader!tether/dist/js/tether.min.js',
      'script-loader!bootstrap/dist/js/bootstrap.min.js',
      './app.js',
    ],
  },
  output: {
    path: path.join(buildPath, 'dist'),
    filename: '[name].js',
    publicPath: 'http://localhost:3001/',
  },
  resolve: {
    extensions: [ '.js', '.jsx', ],
    alias: {
      // Container
      Container: path.resolve(__dirname, 'src/client/scenes/Container.jsx'),
      // Components
      FormComponent: path.resolve(
        __dirname,
        'src/client/scenes/feature/components/FormComponent.jsx'
      ),
      Feature: path.resolve(__dirname, 'src/client/scenes/feature/Feature.jsx'),
      TitleComponent: path.resolve(
        __dirname,
        'src/client/scenes/home/components/TitleComponent.jsx'
      ),
      Home: path.resolve(__dirname, 'src/client/scenes/home/Home.jsx'),
      Navigation: path.resolve(__dirname, 'src/client/scenes/shared/navigation/Navigation.jsx'),
    },
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules|dist|build/,
        loader: 'babel-loader',
        options: {
          babelrc: true,
        },
      },
      {
        test: /\.local\.(css|scss)$/,
        use: [
          'style-loader',
          'css-loader?sourceMap&modules&importLoaders=1&localIdentName=[path]___[name]__[local]___[hash:base64:5]',
          'postcss-loader?sourceMap',
          'sass-loader?sourceMap',
          {
            loader: 'sass-resources-loader',
            options: {
              resources: [
                path.resolve(__dirname, './src/client/styles/scss/variables.scss'),
              ],
            },
          },
        ],
      },
      {
        test: /^((?!\.local).)+\.(css|scss)$/,
        use: [
          'style-loader',
          'css-loader?sourceMap',
          'postcss-loader?sourceMap',
          'sass-loader?sourceMap',
        ],
      },
      {
        test: /\.(gif|png|jpg)$/,
        /* We can specify custom publicPath if needed */
        loader: 'url-loader',
      },
    ],
  },
  plugins: [
    new Write(),
    new webpack.NamedModulesPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
      jquery: 'jquery',
    }),
  ],
}