fix(data): keep node:fs out of the browser-built data modules (#83)

naturalEarthRegions.js and neighborhoodPolygons.js each carried an
isNode branch that dynamically imported node:fs to read their bundled JSON
packs, because a plain dynamic JSON import needs an import attribute in
Node. Vite only warns about externalizing node:fs for the browser, so both
warnings survived every production build and the runtime boundary rested on
an environment guard.

Give both loaders the import attribute instead. Vite bundles the JSON as a
module exactly as before (the emitted regions/marine/san-francisco chunks
are byte-identical), Node loads the same files under node:test, and the
isNode split disappears.

Add a source-boundary test so a node: import cannot silently return to a
browser-built module.

Closes #34
This commit is contained in:
Ethan Stoner authored and GitHub committed 2026-08-31 15:25:02 -05:00
1 parent ac927de71a
commit 6d83bb6008
4 files changed
+49 -27

No files matched your search

+3
View File
@@ -43,6 +43,9 @@ of current runtime behavior, see [`docs/CURRENT-STATE.md`](docs/CURRENT-STATE.md
outages and wait for measured photoreal-surface evidence before a 3D model
takes over from its billboard.
- Cockpit altitude uses aviation MSL data rather than Cesium render height.
- The bundled Natural Earth region and neighborhood-polygon packs load through a
single import path in both the browser and `node:test`, so the production
build no longer externalizes `node:fs` for two browser data modules.
### Security