Skip to content

Templates do not provide build-time dead-code elimination #20893

Open

Description

@TSenter

🐞 Describe the Bug

Templates do not provide build-time dead-code elimination.

🔬 Minimal Reproduction

Create a new GJS/GTS component:

<template>
  {{#if false}}
    This should never appear
  {{/if}}
</template>

Reproduction: https://stackblitz.com/edit/github-v3j3hzvu. Note that the "Sample C" component works but does not perform DCE.

This is related to embroider-build/embroider#2453

Activity

  1. NullVoxPopuli commented on Apr 15, 2025

    @NullVoxPopuli
    SponsorContributor

    I think a better example of this would be

    {{#if false}}
      should not exist when compiled
    {{/if}}
  2. NullVoxPopuli commented on May 6, 2026

    @NullVoxPopuli
    SponsorContributor

    I think this could be implemented via one of our template-compiler plugins

  3. kategengler commented on Aug 11, 2026

    @kategengler
    Member

    Should this be an RFC? Or an issue on the appropriate package?

  4. NullVoxPopuli commented on Aug 12, 2026

    @NullVoxPopuli
    SponsorContributor

    I think this is the appropriate package since this one includes the template compiler

    I would consider this bugfix territory, rather than RFC -- perceived behavior would be unnoticed by everyone who isn't looking at how templates are compiled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions