const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require('webpack'); const config = require('./webpack.common.config'); config.entry = { client: [ '@babel/polyfill', path.join(__dirname, 'register-packets.js'), path.join(__dirname, 'register-traits.js'), '@avocado/behavior/item/initialize', 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.module.rules[1].use.options.paths.push( path.resolve(__dirname, 'client'), ); config.module.rules[2].use.options.paths.push( path.resolve(__dirname, 'client'), ); 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', })); config.plugins.push(new webpack.DefinePlugin({ AVOCADO_CLIENT: true, AVOCADO_SERVER: false, })); module.exports = config;