You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is supposed to not bundle the mocking code when mocking is not enabled, especially for production builds. I think this would not cause any trouble if we had all those package-* as v2 addons.
But some are v1, and as their modules would get eagerly bundled into the app, we have some broccoli-funnel logic in place that removes their /mocking-stuff/** modules according to the same logic that sets the isEnabled flag on mocking-addon. But this causes a problem now, as in a non-production build (with isEnabled being turned to false) eai would still see those importSync calls, add all those package-*/mock-stuff modules as dependencies of the AMD shim, but some of them don't exist (those from v1 addons), causing loader.js runtime errors.
This is a bit similar to embroider-build/ember-auto-import#582, which we "solved" by the optimization done in #1468, that had the pleasant side-effect of removing those importSyncs due to eager branch elimination. And I wonder if we could leverage the same approach here, by having some way to threat get*Config as a build-time only macro without a runtime implementation.
AFAICT, the API where you could actually change config at runtime seems to be in this obscured place, and it also seems to be only used by us (Embroider itself) for that fastboot detection, is that correct?
If so, could we think of ways to either opt-in into a static way of handling the config (thereby enabling eager branch elimination), or even do that by default and only opt-in into a runtime backed implementation when we have detected FastBoot?
The text was updated successfully, but these errors were encountered:
We agreed to make this backwards compatible to not force a major version for macros. But to have a way out of this special handling for whenever we do a new major version, should we introduce a dedicated isFastboot() or (isFastbootRunning() ?) macro for this special use case, and deprecate getGlobalConfig().fastboot.isRunning?
FWIW, a code search on emberobserver revealed that
there is just one (OSS) addon checking for fastboot.isRunning: ember-head
no addon is making use of _embroider_macros_runtime_config
The following pseudo-code show the problem we are running into:
This is supposed to not bundle the mocking code when mocking is not enabled, especially for production builds. I think this would not cause any trouble if we had all those package-* as v2 addons.
But some are v1, and as their modules would get eagerly bundled into the app, we have some broccoli-funnel logic in place that removes their
/mocking-stuff/**
modules according to the same logic that sets theisEnabled
flag onmocking-addon
. But this causes a problem now, as in a non-production build (withisEnabled
being turned to false) eai would still see thoseimportSync
calls, add all thosepackage-*/mock-stuff
modules as dependencies of the AMD shim, but some of them don't exist (those from v1 addons), causing loader.js runtime errors.This is a bit similar to embroider-build/ember-auto-import#582, which we "solved" by the optimization done in #1468, that had the pleasant side-effect of removing those importSyncs due to eager branch elimination. And I wonder if we could leverage the same approach here, by having some way to threat
get*Config
as a build-time only macro without a runtime implementation.AFAICT, the API where you could actually change config at runtime seems to be in this obscured place, and it also seems to be only used by us (Embroider itself) for that fastboot detection, is that correct?
If so, could we think of ways to either opt-in into a static way of handling the config (thereby enabling eager branch elimination), or even do that by default and only opt-in into a runtime backed implementation when we have detected FastBoot?
The text was updated successfully, but these errors were encountered: