【问题标题】:gulp and webpack-dev-server, getting an error TypeError: this.sockWrite is not a functiongulp 和 webpack-dev-server,得到一个错误 TypeError: this.sockWrite is not a function
【发布时间】:2016-05-16 11:02:51
【问题描述】:

我正在尝试使用代理选项将 webpack-dev-server 与浏览器同步集成,并将 gulp 作为任务主控...收到此错误

TypeError: this.sockWrite is not a function
  at /.../node_modules/webpack-dev-server/lib/Server.js:29:8
  at Compiler.applyPlugins (/.../node_modules/tapable/lib/Tapable.js:26:37)
  at Compiler.compile (/.../node_modules/webpack/lib/Compiler.js:390:7)
  at Watching.<anonymous> (/.../node_modules/webpack/lib/Compiler.js:46:17)
  at Compiler.next (/.../node_modules/tapable/lib/Tapable.js:67:11)
  at Compiler.invalidAsyncPlugin (/.../node_modules/webpack-dev-middleware/middleware.js:80:3)
  at Compiler.applyPluginsAsync (/.../node_modules/tapable/lib/Tapable.js:71:13)
  at Watching._go (/.../node_modules/webpack/lib/Compiler.js:44:16)
  at Watching.<anonymous> (/.../node_modules/webpack/lib/Compiler.js:36:8)
  at Compiler.readRecords (/.../node_modules/webpack/lib/Compiler.js:302:10)
  at new Watching (/.../node_modules/webpack/lib/Compiler.js:33:16)
  at Compiler.watch (/.../node_modules/webpack/lib/Compiler.js:161:17)
  at module.exports (/.../node_modules/webpack-dev-middleware/middle

配置文件的相关部分附在下面:

gulpfile.js

var webpack = require('webpack')

webpack_dev_server(webpack(webpack_config), {
    hot: true,
    publicPath: webpack_config.output.path,
    stats: {
      color: true
    }
  }).listen(8080, 'localhost', function(err) {
    if (err) {
      throw plugins.util.PluginError('webpack-dev-server', err);
    }
  });

和 webpack.config

module.exports = {
  cache: true,
  debug: true,
  devtool: 'source-map',
  extensions: ['', 'js', '.json', '.coffee'],
  entry: './www/static/js/entry.js',
  output: {
    path: path.join(__dirname, '/www/static/js'),
    filename: 'bundle.js'
  },
  watch: true
};

【问题讨论】:

    标签: gulp webpack webpack-dev-server


    【解决方案1】:

    尝试在 webpack_dev_server 前面添加新的。如果您不新建,则此句柄将设置为全局句柄而不是新对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-12
      • 1970-01-01
      • 2016-06-24
      • 1970-01-01
      • 1970-01-01
      • 2015-10-11
      • 2019-12-03
      • 2020-11-16
      相关资源
      最近更新 更多