humus-old/webpack.common.config.js
2019-04-22 14:07:26 -05:00

69 lines
1.4 KiB
JavaScript

const path = require('path');
const webpack = require('webpack');
const config = {
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;