0
{
  "name": "frontend",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "webpack-dev-server --watch-content-base  --open",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^5.88.2",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^4.15.1"
  }
}

shows the error:---

[email protected] start webpack-dev-server --watch-content-base --open

[webpack-cli] Error: Unknown option '--watch-content-base' [webpack-cli] Run 'webpack --help' to see available commands and options

I cannot understand why I'm getting this error considering in the video I was following it works just fine. If I remove ' --watch-content-base' it works but I'm trying to make sure any code changes are automatically updated on the server.

1 Answer 1

0

I think this is because of a different of versions. v5 has this change that watchContentBase is no more a valid option. It is replaced by static.

Try running this:

npx webpack serve --static-watch

Related comment

Sign up to request clarification or add additional context in comments.

1 Comment

please elaborate where i have to edit the code.

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.