humus-old/webpack.client.config.js

45 lines
1.0 KiB
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = require('./webpack.common.config');
config.entry = {
client: [
'@babel/polyfill',
path.join(__dirname, 'register-traits.js'),
path.join(__dirname, 'client', 'index.js'),
],
};
config.devServer = {
compress: true,
contentBase: path.resolve(__dirname, 'resource'),
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
},
host: '0.0.0.0',
overlay: true,
port: 8421,
proxy: {
'/avocado': {
target: 'http://localhost:8420',
ws: true,
},
},
stats: 'minimal',
watchContentBase: true,
};
config.devtool = 'eval-source-map';
config.node = {
fs: 'empty',
path: 'empty',
};
config.plugins.push(new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'client', 'index.html'),
}));
module.exports = config;