Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HMR with express server with NodeJS API #1511

Open
Schachte opened this issue Oct 31, 2019 · 0 comments
Open

HMR with express server with NodeJS API #1511

Schachte opened this issue Oct 31, 2019 · 0 comments

Comments

@Schachte
Copy link

My goal here is to get a bundle for my serverside express bundle with HMR support using the webpack NodeJS API. I'm not quite sure if I'm approaching this problem correctly.

  // returns 2 item array [0] = client [1] = server
  const config = webpackConfig();

  const devServer = { host, port, ...config.devServer }

  WebpackDevServer.addDevServerEntrypoints(config[0], devServer)

  const compiler = webpack(config)
  const server = new WebpackDevServer(compiler, devServer)

  server.listen(port, host, err => {
    if (err) {
      console.error(err)
      process.exit(1)
    } else if (args.open) {
      openBrowser(`http://${host}:${port}${publicPath}/`)
    }
  })

I'm hoping that the server for node (express) will be running as well as the clientside bundle. How can I achieve this?

@Schachte Schachte changed the title HMR with express server wiht NodeJS API HMR with express server with NodeJS API Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant