Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Use childprocess.fork() instead of cluster #12

@montogeek

Description

@montogeek

I am getting title error after adding webpack-hot-middleware and webpack-dev-middleware to the server as shown here: https://github.com/gaearon/react-hot-boilerplate/blob/master/server.js

Listening at http://localhost:8080
/Users/montogeek/project/node_modules/start-server-webpack-plugin/dist/StartServerPlugin.js:64
      _cluster2.default.setupMaster({ exec: existsAt });
                        ^

TypeError: _cluster2.default.setupMaster is not a function
    at StartServerPlugin.startServer (/Users/montogeek/project/node_modules/start-server-webpack-plugin/dist/StartServerPlugin.js:64:25)
    at StartServerPlugin.afterEmit (/Users/montogeek/project/node_modules/start-server-webpack-plugin/dist/StartServerPlugin.js:36:12)
    at Compiler.applyPluginsAsyncSeries1 (/Users/montogeek/project/node_modules/tapable/lib/Tapable.js:158:13)
    at Compiler.afterEmit (/Users/montogeek/project/node_modules/webpack/lib/Compiler.js:352:8)
    at Compiler.<anonymous> (/Users/montogeek/project/node_modules/webpack/lib/Compiler.js:347:14)
    at /Users/montogeek/project/node_modules/async/dist/async.js:360:16
    at iteratorCallback (/Users/montogeek/project/node_modules/async/dist/async.js:936:13)
    at /Users/montogeek/project/node_modules/async/dist/async.js:844:16
    at MemoryFileSystem.writeFile (/Users/montogeek/project/node_modules/memory-fs/lib/MemoryFileSystem.js:328:9)
    at Compiler.writeOut (/Users/montogeek/project/node_modules/webpack/lib/Compiler.js:341:27)

webpack config:

{
  entry: ["webpack/hot/poll?1000", "babel-polyfill", "./server/index"],
  watch: true,
  target: "node",
  externals: [nodeExternals({ whitelist: ["webpack/hot/poll?1000"] })],
  module: {
    rules: [
      { test: /\.js?$/, use: "babel-loader", exclude: /node_modules/ },
      {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: "css-loader"
        })
      },
      {
        test: /\.svg$/,
        use: "raw-loader"
      },
      {
        test: /\.(png|jpg|gif|eot|ttf|woff|woff2)$/,
        loader: "url-loader",
        options: {
          limit: 10000
        }
      }
    ]
  },
  plugins: [
    new ExtractTextPlugin("styles.css"),
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NamedModulesPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    new StartServerPlugin("server.js")
  ],
  output: {
    path: path.join(__dirname, ".build"),
    filename: "server.js",
    publicPath: "/"
  }
};

Before adding that code, it worked. Maybe a compatibility issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions