Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dependencies, fix type errors, and general improvements. #693

Merged
merged 8 commits into from
Feb 20, 2024

Conversation

majaha
Copy link
Contributor

@majaha majaha commented Feb 5, 2024

I updated the dependencies, most notably Vite to version 5. I also reviewed how Vite was being configured and fixed development builds being used in production.

I also fixed several typescript issues, the code now passes type-checking.

There are also various other little tidy-ups and improvements.

Previously, we were misusing Vite's `import.meta.env.DEV` and `vite --mode` modes to configure the web runtime build as either the game development build, or the slim build for releasing games. This is not the intended use for those variables. They are meant for discerning between developing/debugging or production builds of the wasm4 runtime itself.

You can read more about those variables here: https://vitejs.dev/guide/env-and-mode.html

In particular, updating to Vite 5 broke the wasm4 web-devtools because of this. This commit instead introduces a new environment variable VITE_WASM4_GAMEDEV_MODE to configure the build. It is loaded into the constant `constant.GAMEDEV_MODE`.

I also removed `constant.DEBUG` because it didn't seem to do anything useful.
Change `npm --prefix '../../devtools/web' install` to a normal script rather than
a prepare script, so that it doesn't get run pointlessly during installs like before.
(which is too late to do anything useful anyway.)

Also, use `cd` instead of `--prefix` for simplicity and clarity.
This is reccomended by the vite docs here:
https://vitejs.dev/guide/features#typescript-compiler-options

In the future we should also consider changing our target and useDefineForClassFields settings,  as explained in the link above and also in this esbuild link:
https://esbuild.github.io/content-types/#tsconfig-json
@aduros
Copy link
Owner

aduros commented Feb 20, 2024

This is amazing, thanks a lot!

@aduros aduros merged commit befe3b4 into aduros:main Feb 20, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants