markdown Webpack Dev Server

Posted

tags:

篇首语:本文由小常识网(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的主要内容,如果未能解决你的问题,请参考以下文章

markdown Webpack-dev-server - 模块替换(HMR)不会重新加载PUG文件更改

vue 目录结构解析

ES6环境下webpack配置devServer

构建webpack环境

vue 调用本地json配置

Webpack“开始”:“webpack-dev-server --config=config/webpack.dev.js”,不工作