篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown Webpack Dev Server相关的知识,希望对你有一定的参考价值。
### Webpack Dev Server
* Used to reload changes to the page when you save your code
* Provides a development server
* Add this line to your package.json file within the `scripts` object:
```js
"start": "webpack-dev-server --mode development --open"
```
* This script will keep refreshing upon new changes made to the files
* Need to also add: `npm install html-webpack-plugin --save-dev`
* In `webpack.config.js`:
```js
const HtmlWebpackPlugin = require("html-webpack-plugin");
// within the module.exports object:
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html'
})
]
```
* For the `filename:` option, use `index.html`
* `template:` is our starting html file, the one you make edits to
以上是关于markdown Webpack Dev Server的主要内容,如果未能解决你的问题,请参考以下文章