html: update webpack

This commit is contained in:
Shuanglei Tao
2019-05-17 10:38:20 +08:00
parent 3f21d86622
commit ccea4d2cfa
8 changed files with 3084 additions and 4962 deletions

View File

@@ -1,31 +1,24 @@
const path = require('path');
const merge = require('webpack-merge');
const convert = require('koa-connect');
const proxy = require('http-proxy-middleware');
const config = require('./webpack.config.js');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = merge(config, {
mode: 'development',
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
proxy: [{
context: ['/auth_token.js', '/ws'],
target: 'http://localhost:7681',
ws: true
}]
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.html',
}),
],
serve: {
content: __dirname + '/dist',
add: (app, middleware, options) => {
var ttydProxy = proxy(
[
'/ws',
'/auth_token.js',
],
{
target: 'http://127.0.0.1:7681',
ws: true,
}
);
app.use(convert(ttydProxy));
},
}
template: 'index.html'
})
]
});