refactor: register traits before client/server entry
This commit is contained in:
parent
c901296374
commit
9fd29a64a9
|
@ -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) => {
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -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 = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user