rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.75k stars 211 forks source link

tutorial needs to explain how to deploy wasm app using another webserver #224

Closed ta32 closed 4 years ago

ta32 commented 4 years ago

Where in the docs did you come across this? https://rustwasm.github.io/docs/book/reference/deploying-to-production.html

Describe what about it does not make sense The tutorial needs to explain how to deploy your wasm app using another web-server. The tutorial setups webpack dev server using a template so after following the tutorial new users who have no idea about web-pack will not no where to start to serve this client side app using another web-server like actix web.

Why does it not make sense? Because a template is used that is already integrated with webpack-dev-server and a web-pack is used to bundle the files users new to web-development will easily get confused about these technologies. There needs to be more guidance on some of the frameworks used.

How could we improve it? link you webpack getting started and explain what it does at a high level. Extend the tutorial - section on deploying to production using eg Actix-web Or any other production capable web server

I tried copying the static folder and configuring actix web to serve this directory - however this did not work

Currently The index.html loads and i can see the button but there are console errors

bootstrap.js:1 Uncaught SyntaxError: Unexpected token '<'
DevTools failed to load SourceMap: Could not load content for chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sourcemaps/contentscript.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load SourceMap: Could not load content for chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sourcemaps/inpage.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

The error occured because in order to serve static files at the root you had to call an extra method. Not really an issue with the wasm book so i am closing the issue

ta32 commented 4 years ago

this is my attempt so far to serve the tutorial client side app using actix web https://github.com/ta32/wasm-game-of-life-tutorial

ta32 commented 4 years ago

https://github.com/realSuffix/wasm_game_of_life_actix a person helped me to create a working example.