bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.91k stars 3.55k forks source link

WASM example with Python server doesn't work #3864

Open MiniaczQ opened 2 years ago

MiniaczQ commented 2 years ago

System information

OS: Windows 10 Browsers: Opera GX & Firefox Python: 3.9.10

What you did

Build a project for WASM and tried to launch it with python server as instructed here.

What you expected to happen

App to run properly.

What actually happened

App didn't run. Debugger said that a .js file was sent as text/plain, hence could not be run as a module.

Solutions

  1. Remove python server from examples
  2. Add additional information on how to set it up.
  3. Keep this issue open so if someone gets this rare case they'll find the solution

Additional context

Not everyone seems to have this issue, even with the same python version.

Running the basic-http-server worked just fine, so it's a python thing.

I'm not sure which solution is the right call.

bjorn3 commented 2 years ago

Are you using http.server and not SimpleHTTPServer? For me http.server uses the correct mime types for js and wasm.

MiniaczQ commented 2 years ago

I used this exact command (excluding path) python -m http.server --directory

MiniaczQ commented 2 years ago

image image

shulcsm commented 2 years ago

http.server does some naive mime type guessing.
What does python -c 'import mimetypes;print(mimetypes.guess_type("/bevy_game.js"))' say? I suspected you have broken/missingmime.types