Closed surma closed 11 months ago
Calling ./build.sh
is still the right thing to do, exactly so that CI keeps working. Is it broken?
build.sh
is not called at all atm in the CI, as all the final files would end up in the www
folder anyway, so we need another step after the wasm builds to call build.sh
edit: I added it in https://github.com/gbdev/rgbds-live/pull/19/commits/d07f634cdc45b1cfd2c3125e1991863375ba36c7
This PR introduces Vite as the build system for RGBDS Live.
I tried to do minimal changes to the code, so currently there’s still lots of globals and stuff, but the PR got big enough as it is. This already does some nice optimizations in that it bundles all the JavaScript and CSS files and minifies them, which should make the site load faster.
These are the changes introduced by this PR:
www
.package.json
to importvite
and to declarenpm run build
andnpm run dev
build scripts.-s EXPORT_ES6=1
to Wasm builds so that the output is a ES6 module. This makes it easier to use the Wasm builds with vite.-s ENVIRONMENT=web
to rgbds builds so that the JS files don’t contain references to Node runtimes.type="module"
which allows us to use ESM imports/exports in the code and will allow us to use top-level await in the future.globalThis
to declare globals as ES6 modules have an isolated global scope by default.