Skip to content

Native TSRX: missing setup semicolon fails runtime compilation while Babel and typecheck projection succeed #3762

Description

@ethan-huo

Describe the bug

The native TSRX runtime compiler rejects a setup declaration without an explicit semicolon immediately before the rendered element. The same source succeeds through Solid's Babel TSRX frontend, @tsrx/solid, and the native compiler's own projectTsrxForTypecheck.

Reproduced with @solidjs/compiler 2.0.0-rc.10 and 2.0.0-rc.13. Adding one semicolon makes native compilation succeed.

Minimal example / steps to reproduce

No application, Vite, StyleX, or runtime is required. This is a direct compiler API reproduction.

mkdir solid-tsrx-semicolon-repro
cd solid-tsrx-semicolon-repro
printf '{"private":true,"type":"module"}\n' > package.json
bun add @solidjs/compiler@2.0.0-rc.13

Save this as repro.mjs and run node repro.mjs:

import { transform, projectTsrxForTypecheck } from '@solidjs/compiler';

const source = `export function F() @{
  const a = () => 1
  <div>{a()}</div>
}`;

// This succeeds, producing a declaration with a semicolon and a return.
console.log(projectTsrxForTypecheck(source, { filename: 'F.tsrx' }).code);

for (const generate of ['dom', 'ssr']) {
  try {
    console.log(transform(source, { filename: 'F.tsrx', generate }).code);
  } catch (error) {
    console.error(generate, error.message);
  }
}

// Both runtime modes succeed with this single-character change.
const fixed = source.replace('() => 1\n', '() => 1;\n');
for (const generate of ['dom', 'ssr']) {
  console.log(transform(fixed, { filename: 'F.tsrx', generate }).code);
}

Actual error in both native RC13 runtime modes:

Unable to load authored TSRX statement at 25..45

Expected behavior

Native DOM and SSR compilation should accept this source, consistently with the Babel TSRX frontend and the native typecheck projection. Omitting the semicolon should not produce an internal statement-loading failure.

Platform

  • macOS, arm64
  • Node.js v26.10.0
  • @solidjs/compiler: 2.0.0-rc.10 and 2.0.0-rc.13
  • No browser involved; failure happens in the compiler API

Additional context

Isolated comparison using the exact same source:

Path Without semicolon With semicolon
Native RC10 DOM Fails Succeeds
Native RC13 DOM Fails Succeeds
Native RC13 SSR Fails Succeeds
Native RC13 projectTsrxForTypecheck Succeeds Succeeds
@solidjs/babel-plugin RC13, @babel/core 7.29.7 Succeeds Succeeds
@tsrx/solid 0.3.3 compile Succeeds Succeeds

For the Babel comparison, I used transformSync(source, { filename: 'F.tsrx', configFile: false, babelrc: false, plugins: [solid] }). For the TSRX target comparison, I used compile(source, 'F.tsrx').

Explicit semicolons provide a workaround. I have not built unreleased next from source, so this report establishes the behavior of the published RCs above, not current unreleased binaries.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions