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({
|
||||
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);
|
||||
}
|
||||
});
|
||||
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) => {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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 = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user