mike perry

Members
  • Content count

    2
  • Joined

  • Last visited

  1. mike perry

    Multiplayer game - the "script" element could not be loaded

    Thanks for reply. I solved this problem by indicate to the folder in which the scripts are located . In my case it was a folder called 'dev'. Adding this line solved the problem: app.use('/dev', express.static('dev')) Additional question Is there any way to run webpack only for build scripts not for running webpack server? The node server needs scripts to open the HTML file correctly. Scripts are built by running webpack in development mode. Is it good practise if I start webpack and node server with one command? Something like below (using "start"). "start": "concurrently --kill-others \"npm run dev\" \"npm run server\"", "dev": "webpack --mode=development", "deploy": "webpack --mode=production --config webpack.production.config.js", "server": "nodemon ./src/server/server.js --exec babel-node",
  2. How do you configure the server for this template ? => https://github.com/nkholski/phaser3-es6-webpack I'm trying to do it by following this tutorial => https://gamedevacademy.org/create-a-basic-multiplayer-game-in-phaser-3-with-socket-io-part-1/?a=13 I added two dependencies: nodemon and express. I created the server.js file with the server configuration. const express = require('express') const app = express() const server = require('http').Server(app) const path = require('path') app.get('/', function(req, res) { res.sendFile(path.resolve('index.html')) }) server.listen(8081, function() { console.log(`Listening on ${server.address().port}`) }) In the package.json file, I added a command to start the server: nodemon src/server/server.js The server starts correctly but the indicated html file can not read the scripts (" The load failed for the "script" element with the source vendor.js and app.js"). Project structure: