webpack notes

miscellaneous webpack-dev-server configuration notes

webpack-dev-server can be configured from: cli or config file.

from the cli

package.json:

{
  ...
  "scripts": {
    "start": "webpack-dev-server --content-base ./dist --host 0.0.0.0 --open --port 8080 --public 192.168.1.123:8080"
  }
  ...
}

from the config file

webpack.config.js:

module.exports = {
  mode: "development",
  ...
  devServer: {
    contentBase: path.join(__dirname, "dist"),
    host: "0.0.0.0",
    open: true,
    port: 8080,
    public: "192.168.1.123:8080"
  }
  ...
};

© 2020 | Paul Kim