Skip to content

[Bug?]: solid-start's dev mode oversees that function statements are hoisted, leads to errors #51

@danieltroger

Description

@danieltroger

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Right now, solid-start in dev mode transforms function statements to var statements, without considering function hoisting. This can break code, as can be seen in the reproduction steps.

Screenshot 2024-01-08 at 17 42 36 Screenshot 2024-01-08 at 17 42 46

Expected behavior 🤔

Valid javascript code should still run in dev mode

Steps to reproduce 🕹

Steps:

  1. Clone https://github.com/danieltroger/solid-start-hoisting-issue
  2. yarn dev
  3. visit localhost:3000
  4. observer error in dev console

Context 🔦

I prefer having the exported thing at the top of modules. Like in the attached example I have a case where I want to add a symbol to a function, however I have to do it in an IIFE in the export so that I can add a pure comment and the module still can be tree-shaken.

Your environment 🌎

M1 Max 16" MBP, node v21.5.0 on macOS 14.2.1 (23C71)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions