The Webpack documentation for devServer.contentBase
says
It is also possible to serve from multiple directories:
webpack.config.js
module.exports = {
//...
devServer: {
contentBase: [path.join(__dirname, 'public'), path.join(__dirname, 'assets')]
}
};
Usage via the CLI
webpack-dev-server --content-base /path/to/content/dir
I don't know how to pass multiple paths via CLI.
In my package.json
"scripts": {
"build": "webpack",
"start:dev": "webpack-dev-server --content-base dist"
},
I tried passing following values for start:dev
command but none of them worked.
webpack-dev-server --content-base dist src/css
webpack-dev-server --content-base dist, src/css
webpack-dev-server --content-base 'dist src/css'
webpack-dev-server --content-base 'dist', 'src/css'
webpack-dev-server --content-base [ 'dist', 'src/css' ]
I found one related post but couldn't figure out the solution.
Also is there any standard being followed which specifies how an argument accepting an array of values should be specified on command-line? If yes then please provide a reference to that.