webpack4中预加载不成功也无报错解决办法:
安装过程:
npm i webpack-dev-server webpack-dev-middleware webpack-hot-middleware -D
配置
webpack.config.js
const webpack = require('webpack');
......
plugins: [
new VueLoaderPlugin(),
new webpack.HotModuleReplacementPlugin()
],
devServer: {
publicPath: '/dist/',//你的bundle.js文件夹
host: 'localhost',
port: '8080',
open: true,//自动拉起浏览器
hot: true//热加载
},
运行命令
node_modules/.bin/webpack-dev-server --mode development