Skip to content

innerHTML optimization is not enabled in dev mode #7943

@baseballyama

Description

@baseballyama

Describe the bug

If an element has entirely static contents, Svelte compiles it to a simple component that uses innerHTML in prod mode.
But in dev mode doesn't use innerHTML.
Dev and prod mode should generate same runtime code. Otherwise it will be bit difficult to find bugs during dev.

<div>
	<p>Hi!</p>
</div>

Reproduction

https://svelte.dev/repl/33acf2c678134daf9abb68059cc34aa7?version=3.51.0

Logs

No response

System Info

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
    Memory: 77.67 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.19.0 - ~/.nodenv/versions/14.19.0/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.18.0 - ~/.nodenv/versions/14.19.0/bin/npm
  Browsers:
    Chrome: 106.0.5249.119
    Firefox: 104.0.1
    Safari: 16.0
  npmPackages:
    rollup: ^2.3.4 => 2.60.0 
    svelte: ^3.50.1 => 3.51.0

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions