Skip to content

Fix production build and align tooling versions - #122

Merged
jh0ker merged 7 commits into
developfrom
chore/build-tooling
Oct 12, 2026
Merged

jh0ker merged 7 commits into
developfrom
chore/build-tooling

Conversation

@jh0ker

@jh0ker jh0ker commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

First of five stacked PRs that split up experiment/fix-local-dev-setup. This one should merge first: develop currently fails production builds.

  • Production build: exclude the prebuilt ffmpeg worker from Terser. Minifying the 13 MB file fails with RangeError: Set maximum size exceeded, so NODE_ENV=production builds on develop fail, including the PR checks and deploy workflows.
  • Versions: pin Node 24 (.nvmrc) and Yarn 1.22.22 (packageManager), and align the app's TypeScript with CDK (5.9). In the app, TypeScript is only used by the sprite importer; the version mismatch caused editor conflicts when opening the repo root.
  • Lint: ignore *.ts, cdk/node_modules and cdk/cdk.out in ESLint. Without this, yarn lint crashes on a config file inside cdk/node_modules.
  • Offline precaching: port the service worker's precaching of library and game media (/data/assets/) to webpack 5. The production service worker precaches these files for offline mode. The webpack 4 plugin that listed them was disabled in the Node 16 update (bc3c6a1); a Workbox manifestTransforms entry now adds the same files. It produces the same 158 entries as the current production manifest. The old plugin and its two dev dependencies are removed.
  • Service worker source: the service worker is now built from src/service-worker.js with InjectManifest. static/sw-helper.js used the global workbox object from Workbox 4's loader, which Workbox 5's GenerateSW no longer provides. It threw on install, so enabling offline mode failed. The new source contains the former GenerateSW config plus the helper: precached videos are served with range request support for Safari, registered before the precache route as in production, and quota errors are reported to the page. The runtime assets route added in 2024 now skips precached URLs. Without that it answers them from its own, initially empty cache, because the router's fetch listener runs before the precache listener.

Now that lint runs, it reports 84 existing errors in older src/ files. PR checks don't run lint, and this PR doesn't touch those files.

Tested: production build, yarn install --frozen-lockfile, and the generated precache list compared against production's s3-manifest.

jh0ker added 4 commits October 6, 2026 16:43
When opening the project root in VSCode, this could cause conflicts. In the app, Typescript is only used for the sprite importer script.
this would fail the production build, trying to minify a 13mb (already minified) js file
@netlify

netlify Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for peaceful-raindrop-cb2462 ready!

Name Link
🔨 Latest commit 7435eba
🔍 Latest deploy log https://app.netlify.com/projects/peaceful-raindrop-cb2462/deploys/6acd02a85648c4b34a4e236d
😎 Deploy Preview https://deploy-preview-122--peaceful-raindrop-cb2462.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@jh0ker
jh0ker added this pull request to stack #127 October 6, 2026 15:37
@netlify

netlify Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for serene-narwhal-9b7b1c ready!

Name Link
🔨 Latest commit 7435eba
🔍 Latest deploy log https://app.netlify.com/projects/serene-narwhal-9b7b1c/deploys/6acd02a85648c4b34a4e2369
😎 Deploy Preview https://deploy-preview-122--serene-narwhal-9b7b1c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

The production service worker precaches the library and game media from
/data/assets/ for offline mode. The webpack 4 plugin that added them was
disabled in the Node 16 update (bc3c6a1). A Workbox manifest transform
now adds the same entries; filenames are content hashes, so they need no
revision.
@jh0ker
jh0ker force-pushed the chore/build-tooling branch 2 times, most recently from 58ced18 to d2e0457 Compare October 6, 2026 17:08
@jh0ker
jh0ker marked this pull request as ready for review October 7, 2026 11:41
@colorchestra

Copy link
Copy Markdown
Collaborator

approved!

static/sw-helper.js relied on the global workbox object from Workbox 4's
workbox-sw loader. Workbox 5's GenerateSW bundles the runtime as a module
instead, so the helper threw on install and offline mode failed.

src/service-worker.js now imports the Workbox modules and contains the
former GenerateSW config and the helper: video requests are served from
the precache with range request support (registered before the precache
route, as in production), and quota errors are reported to the page.

Because the router's fetch listener now runs first, the runtime assets
route skips precached URLs. Otherwise it would answer them from its own,
initially empty cache instead of the precache.
The settings bundle was excluded from the precache since 67854ff, while
settings/index.html was still precached. Offline, /settings/ loaded the
HTML but not its script, and /settings did not match any route. The page
only toggles local feature flags, so precache its bundle and serve it for
both paths.

The sharing page shows media from /data/sharing/, which cannot work
offline. Exclude its HTML so it fails like any other offline page instead
of rendering blank.
@jh0ker
jh0ker force-pushed the chore/build-tooling branch from d2e0457 to 7435eba Compare October 12, 2026 15:54
@jh0ker
jh0ker merged commit 79280a4 into develop Oct 12, 2026
12 checks passed
@jh0ker
jh0ker deleted the chore/build-tooling branch October 12, 2026 16:03
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