humus-old/webpack.client.config.js

69 lines
1.7 KiB
JavaScript
Raw Normal View History

2019-03-20 15:28:18 -05:00
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
2019-03-20 15:28:18 -05:00
const config = require('./webpack.common.config');
config.entry = {
client: [
'@babel/polyfill',
2019-04-25 00:09:28 -05:00
'register-packets',
2019-09-22 18:45:52 -05:00
'register-synchronizeds',
2019-04-25 00:09:28 -05:00
'register-traits',
'@avocado/behavior/item/initialize',
path.join(__dirname, 'client', 'index.js'),
2019-03-20 15:28:18 -05:00
],
};
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';
2019-05-05 17:03:15 -05:00
// Babel config file.
config.module.rules[0].use.options.configFile = path.resolve(
__dirname, 'babel.client.config.js'
);
2019-04-14 20:39:27 -05:00
config.module.rules[1].use.options.paths.push(
path.resolve(__dirname, 'client'),
);
2019-04-14 21:32:48 -05:00
config.module.rules[2].use.options.paths.push(
path.resolve(__dirname, 'client'),
);
2019-09-22 18:45:52 -05:00
config.module.rules[3].use.options.paths.push(
path.resolve(__dirname, 'client'),
);
2019-03-20 15:28:18 -05:00
config.node = {
fs: 'empty',
path: 'empty',
};
config.plugins.push(new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'client', 'index.html'),
}));
config.plugins.push(new webpack.ProvidePlugin({
THREE: 'three',
}));
2019-04-22 21:03:16 -05:00
config.plugins.push(new webpack.DefinePlugin({
AVOCADO_CLIENT: true,
AVOCADO_SERVER: false,
}));
2019-03-20 15:28:18 -05:00
module.exports = config;