- Replace all iterator spreads ([...map.values()] etc) with Array.from() across engine and viewer: under the TS->babel downlevel chain they compiled to __spreadArrays, which reads .length on an iterator and produced 'RangeError: invalid array length' on 'Sector rotations finished' (the reported boardgamers.space crash), plus several latent same-class sites. - Break the research-tracks.ts -> ../index barrel import cycle (imports Event/Expansion from leaf modules now): the cycle left Engine in TDZ and the whole bundle failed with 'Cannot access engine_Engine before initialization' at module eval under the rebuilt module order. - Fix stale cache-loader output producing raw vue_1.default accesses for the vue webpack external (window.Vue has no .default): 'Cannot read properties of undefined (reading extend)' at load. Clean rebuild emits babel interop wrappers correctly. vue-global-shim.js added as belt-and-braces doc for the external's shape. - Add autoprefixer as an explicit viewer devDependency (pnpm 11 no longer hoists it; the lib build failed on postCSS plugin load). - Update stale spec type signatures surfaced by the import change (tile position as EventSource, loadFaction arity, ChargeRequest literal cast, AvailableCommand data narrowing, FederationInfo new fields). Verified: engine 750 passing / 4 pending; viewer 809 passing; lint + prettier clean; rebuilt UMD has zero iterator-spread call sites and loads + completes sector rotation (with and without rotations) in Chromium against the real bundle with CDN-provided Vue 2.
37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
/* eslint-disable */
|
|
// Lib-build shim for the webpack external 'vue'.
|
|
//
|
|
// The published UMD keeps `vue` external - the host page (boardgamers.space's iframe wrapper or
|
|
// the demo html) provides `window.Vue`. That global is a plain function (Vue 2's UMD export)
|
|
// with NO `.default` property. TypeScript's esModuleInterop emits `vue_1.default` for
|
|
// `import Vue from "vue"`, which is undefined for that shape and crashed the bundle at
|
|
// module-eval time ("Cannot read properties of undefined (reading 'extend')") in every
|
|
// component that calls Vue.extend at module scope.
|
|
//
|
|
// Resolving `vue$` here normalizes the global into a proper ES-module-shaped object, so
|
|
// default imports, namespace imports, and plain CJS requires all work against it.
|
|
//
|
|
// Kept at the repo root (next to vue.config.js); only wired in the `lib` branch of
|
|
// vue.config.js, never in dev/serve builds (those use the real vue package).
|
|
(function () {
|
|
var actual;
|
|
if (typeof window !== "undefined" && typeof window.Vue === "function") {
|
|
actual = window.Vue;
|
|
} else if (typeof global !== "undefined" && typeof global.Vue === "function") {
|
|
actual = global.Vue;
|
|
} else if (typeof Vue === "function") {
|
|
actual = Vue; // eslint-disable-line no-undef
|
|
} else if (typeof require === "function") {
|
|
try {
|
|
actual = require("vue");
|
|
} catch (e) {
|
|
actual = undefined;
|
|
}
|
|
}
|
|
if (actual && !actual.__esModule && actual.default === undefined) {
|
|
actual = Object.assign({ default: actual, __esModule: true }, actual);
|
|
}
|
|
if (typeof module !== "undefined" && module.exports) {
|
|
module.exports = actual;
|
|
}
|
|
})();
|