humus-old/webpack.common.config.js
2019-04-14 21:32:48 -05:00

71 lines
1.5 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const config = {
devtool: 'inline-source-map',
mode: 'development',
module: {
rules: [
{
test: /\.js$/,
exclude: [
/(node_modules\/(?!@avocado|contempo))/,
],
use: {
loader: 'babel-loader',
},
},
{
test: /register-packets\.js/,
use: {
loader: './defgen',
options: {
classTransformer: (Packet) => {
return `${Packet}Packet`;
},
paths: [
path.resolve(__dirname, 'common'),
],
registrar: {
function: 'registerPacket',
module: '@avocado/packet',
},
type: 'packet',
},
},
},
{
test: /register-traits\.js/,
use: {
loader: './defgen',
options: {
paths: [
path.resolve(__dirname, 'common'),
],
registrar: {
function: 'registerTrait',
module: '@avocado/entity',
},
type: 'trait',
},
},
},
],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
},
plugins: [
],
resolve: {
modules: [path.resolve(__dirname, 'node_modules')],
},
resolveLoader: {
modules: [path.resolve(__dirname, 'node_modules')],
},
};
module.exports = config;