Allow configuring Embroider macros via a configure option#27
Open
rmoodyab wants to merge 1 commit into
Open
Conversation
ember-astro called buildMacros() with no options, so consumers couldn't supply
macros config. Compiling Ember apps/libraries gated on getGlobalConfig() then
failed — e.g. importing a library that depends on WarpDrive/ember-data, whose
published code runs macroCondition(getGlobalConfig().WarpDriveMirror.env.PRODUCTION),
throws 'Cannot read properties of undefined (reading env)'.
Forward a `configure` callback to buildMacros({ configure }) (a documented
buildMacros option). Backward compatible: omitting it behaves exactly as before.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
NullVoxPopuli
requested changes
Jun 30, 2026
NullVoxPopuli
left a comment
Member
There was a problem hiding this comment.
Hello! thanks for your contribution!
I think instead of trying to accommodate every way of configuring babel, we should auto-detect the presence of a babel config (using babel's APIs to d o this), and then specify the path to that babel config -- then the babel config we have inline here should just be "the default" (only used when we don't detect a local babel config)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ember-astrocallsbuildMacros()with no options, so consumers can't supply Embroider macros config. Compiling any Ember app/library gated ongetGlobalConfig()then fails.Concretely: importing a component library that depends on WarpDrive / ember-data — whose published code runs
macroCondition(getGlobalConfig().WarpDriveMirror.env.PRODUCTION)— throws during the build:because
getGlobalConfig().WarpDriveMirroris undefined (no macros config was registered). A normal Ember app build supplies this viaember-cli-build/setConfig; there was no equivalent hook for the Astro integration.What
Forward a
configurecallback tobuildMacros({ configure })(one of its documented options), so consumers can register global config:The
buildMacros()call also moves into the integration factory so the option is honored per-instantiation.Backward compatibility
Fully backward-compatible — when
configureis omitted,buildMacros({ configure: undefined })behaves exactly as the previousbuildMacros()call.Notes
Verified end-to-end: this is the only
ember-astrochange needed to compile a real Ember component library (that transitively pulls in WarpDrive) and render live examples inline in an Astro site. Happy to broaden this to a fullmacrosoptions passthrough (buildMacros(options.macros)— exposingsetOwnConfig/setConfig/configure) if you'd prefer that shape.