1

I'm building a client with react and am running npm start and in package.json my scripts look like this:

"scripts": {
    "start": "webpack-dev-server"
  }

But i've also code other server side code in server/app.js that I want to run and if I run node app.js then that runs but i'd like server/app.js to be included with webpack-dev-server so that when I run npm start server/app.js is also run.

Is that possible? I was reading up on the various options and at this stage after the simplest.

Thx.

1 Answer 1

2

Update your script as follows:

"scripts": { 
     "start": "webpack-dev-server && node app.js"
 }
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. This is where I'm a bit confused. In my server folder i've got app.js and a test.html page and when I run "node app.js" I can load test.html and the server scripts in app.js run and the websocket connects. But when I also run webdev-server-pack && node app.js I keep getting the same error message that the websocket is connecting but it actually never does. Been reading up all day on it but not sure where the prob lies. Thx.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.