Closed jhrcek closed 3 weeks ago
Maybe we should add a script: bin/sdist
(or something) that runs webpack with a flag to override this and package everything. Definitely feel free to take a crack at a PR if you want!
If I was to add a script for this, it would look like this:
#!/usr/bin/env bash
pushd client
npm instal
npx webpack --mode=production
popd
cabal sdist
# ? it might be nicer if the "production" version was checked in git ?
git checkout client/dist/hyperbole.js
What's slightly annoying is that after you run it, it modifies a bunch of files that are checked in the repository, so you have to check them out after that. But then you could just set the mode to production in webpack config by default and check the production js build in the repo, which is what I'm proposing.
The differences between prod and dev. build: smaller js size (20kB vs 52kB), no warnings about dev mode being used (looks "unprofessional" in hackage distro), but less readability when debugging in browser dev. console (but you could always build with dev mode to troubleshoot :smile: )
While browsing the sources I noticed that you're including development build of hyperbole.js in the hackage source distribution.
It might be better to use
mode: "production"
as recommended here: https://github.com/seanhess/hyperbole/blob/37091269b0fc081f53ed5ce752e57db3dcbd7430/client/dist/hyperbole.js#L7(At least for when releasing the next version to hackage)