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

View File

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

View File

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