Skip to content

Commit d4b4324

Browse files
lifeartclaude
andcommitted
fix(ci): define gxt build-time constants in classic-mode vite config
Classic mode pulls in glimmer-next runtime code via @ember/-internals/glimmer even though the gxt compiler plugin doesn't run. Without inlined values for WITH_CONTEXT_API / IS_DEV_MODE / etc., the bundled gxt code references them as free identifiers and crashes at runtime ("ReferenceError: WITH_CONTEXT_API is not defined"), which globally fails ~3800 tests. Define the constants for classic mode only; in GXT mode the compiler plugin inlines them itself and double-replacement could conflict. Before: 1924/5800 tests passing (33%, 3876 ReferenceError). After: 5114/9291 tests passing (55%, zero ReferenceError). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 028f05c commit d4b4324

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

vite.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ export default defineConfig(({ mode }) => {
126126
overlay: false,
127127
},
128128
},
129+
// In classic mode the gxt compiler plugin doesn't run, but glimmer-next
130+
// runtime code is still bundled (statically imported by
131+
// @ember/-internals/glimmer). That code references build-time constants
132+
// (WITH_CONTEXT_API, IS_DEV_MODE, etc.) which would otherwise survive as
133+
// free identifiers and crash at runtime. Define them here so the bundled
134+
// gxt code behaves correctly. In GXT mode the compiler plugin inlines
135+
// these itself, so we omit `define:` to avoid double-replacement.
136+
...(useGxt
137+
? {}
138+
: {
139+
define: {
140+
IS_GLIMMER_COMPAT_MODE: 'true',
141+
WITH_EMBER_INTEGRATION: 'true',
142+
WITH_HELPER_MANAGER: 'true',
143+
WITH_MODIFIER_MANAGER: 'true',
144+
WITH_CONTEXT_API: 'true',
145+
TRY_CATCH_ERROR_HANDLING: 'false',
146+
IS_DEV_MODE: mode === 'development' ? 'true' : 'false',
147+
},
148+
}),
129149
build,
130150
esbuild: false,
131151
envPrefix: 'VM_',

0 commit comments

Comments
 (0)