sitesmith: alias tiny-invariant to a diagnostic shim

The prod build of tiny-invariant strips all failure messages, leaving
us with bare 'Error: Invariant failed' and no actionable info. Aliasing
the package to a shim that always emits the message + a stack-trace
console.error before throwing — so the next Craft.js invariant we hit
tells us which assertion (ERROR_NOT_IN_RESOLVER, ERROR_NOPARENT,
ERROR_INVALID_NODE_ID, etc.) is actually failing.

Temporary; will revert once the Sitesmith apply flow is stable.
This commit is contained in:
2026-05-24 16:32:50 -07:00
parent 849f432330
commit 43627bddb0
2 changed files with 20 additions and 0 deletions

View File

@@ -8,6 +8,9 @@ export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// Diagnostic: replace tiny-invariant with a shim that always logs the
// failure message (the upstream prod build strips it).
'tiny-invariant': path.resolve(__dirname, './src/utils/tiny-invariant-shim.ts'),
},
},
build: {