Can addons use template-only components?

Came across another question related to Octane and addons: Assuming the addon only supports ember >= 3.15 could it use template-only components without requiring template-only-glimmer-components feature to be enabled on consuming application?

Or should it add an empty glimmer component to prevent a wrapper div if that optional feature is disabled? If so: Does this have any performance impact?

And assuming that’s the case: Did someone already wrote an addon that adds the boilerplate classes at build-time only if needed?

1 Like

Locks pointed me to the RFC which covers that question:

Currently, the only way to create a “true” template-only component is by enabling an optional feature in the app. Since addons cannot assume the value of that flag in the consuming app, they currently cannot take advantage of the feature. By providing this function, addon authors can work around this problem by explicitly defining a JavaScript file with templateOnlyComponent() as the default export.