refactor: register traits before client/server entry

This commit is contained in:
cha0s 2019-03-20 22:23:26 -05:00
parent c901296374
commit 9fd29a64a9
3 changed files with 8 additions and 10 deletions

View File

@ -22,14 +22,12 @@ const entityList = new EntityList();
const stateSynchronizer = new StateSynchronizer({
entityList,
});
setImmediate(() => {
for (let i = 0; i < 20; ++i) {
const x = Math.floor(Math.random() * 1000) + 100;
const y = Math.floor(Math.random() * 500) + 100;
const flowerBarrel = createFlowerBarrelEntity([x, y]);
entityList.addEntity(flowerBarrel);
}
});
// Connection listener.
function createConnectionListener(avocadoServer) {
return (socket) => {

View File

@ -7,8 +7,8 @@ const config = require('./webpack.common.config');
config.entry = {
client: [
'@babel/polyfill',
path.join(__dirname, 'client', 'index.js'),
path.join(__dirname, 'register-traits.js'),
path.join(__dirname, 'client', 'index.js'),
],
};
config.devServer = {

View File

@ -9,8 +9,8 @@ config.entry = {
server: [
'source-map-support/register',
'@babel/polyfill',
path.join(__dirname, 'server', 'index.js'),
path.join(__dirname, 'register-traits.js'),
path.join(__dirname, 'server', 'index.js'),
],
};
config.externals = [