A type imported from a JS module (declared `export type` in its .d.rx, or a package's TS-only type) compiles to a value import; the bundle fails with MISSING_EXPORT
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 56/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- compilers
Piste de recherche
Start with compiler/src/emit.rs at the module import emission around lines 361 and 676–696, then compare the existing type filtering around line 606. Check how .d.rx declarations represent JsDecl::Type and how imports used only in type positions are tracked. Done means type-only names emit neither an ES value import nor a runtime binding; verify with the provided repro and confirm the Vite build no longer reports MISSING_EXPORT.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
A type imported from a JS module compiles to a runtime value import, so the bundler fails on an export that only exists in TypeScript.
Versions: @reactivescript/compiler, @reactivescript/runtime, @reactivescript/language-server 0.3.1; solid-js 2.0.0-rc.21; @solidjs/vite-plugin 3.0.0-next.57.
Repro
lib.d.rx:
export type Outcome = { kind: "idle" } | { kind: "sent" }
export fn post(body: object)
lib.ts:
export type Outcome = { kind: 'idle' } | { kind: 'sent' }
export function post(_b: object) {}
main.rx:
import { StyleXStyles } from "@stylexjs/stylex"
import { Outcome } from "./lib"
export component App({ s }: { s?: StyleXStyles }) {
source o: Outcome := { kind: "idle" }
<p>{o.kind}</p>
}
app("main.rx", "dom") from the compiler's Node-API reports no diagnostic and emits:
import { StyleXStyles as w$StyleXStyles } from "@stylexjs/stylex";
import { Outcome as w$Outcome } from "./lib";
...
const v$StyleXStyles = w$StyleXStyles;
__rt.reg("StyleXStyles", { value: v$StyleXStyles });
const v$Outcome = w$Outcome;
__rt.reg("Outcome", { value: v$Outcome });
A Vite (Rolldown) build then fails with MISSING_EXPORT for both names: neither lib.ts nor @stylexjs/stylex exports them as values.
Expected
guide/reference.md says there is no import type and types are imported the same way, and MO-6c says an imported type "binds no value". So:
Outcomeis declaredexport typein the.d.rxbeside the module (MO-8a). The compiler knows it is a type and should emit neither the ES import nor the binding.StyleXStyleshas no.d.rx, so only its use tells the compiler it is a type. A name an import binds that is only read in type positions should be erased too. Otherwise a type from a package cannot be imported at all; the only workaround is an inlineimport("@stylexjs/stylex").StyleXStylestype.
Cause
.rx imports already skip types: compiler/src/emit.rs:606 checks Decl::TypeDecl / ExportSig::Type and continues ("a type binds nothing"). JS imports (resolved: None) have no such check, even when the .d.rx declares the name as JsDecl::Type:
compiler/src/emit.rs:361builds the module-levelimport { … }from every name;compiler/src/emit.rs:676-696binds every name tow$<alias>and emits__rt.reg.
Both should drop a name the declaration file declares as a type, and ideally a name that is used only in type positions.
- Langage dominant
- TypeScript
- Étoiles
- 127
- Forks
- 7
- Merge moyen
- 15 h 42 min
- PR mergées (30 j)
- 63
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de solidjs/reactivescript
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
solidjs/reactivescript#96 ·
Les mainteneurs répondent en général sous 1 jour
-
Vite front end keeps serving a failed build after the missing/broken imported module is fixedPeut-être pris @cgaaf l’a pris il y a 1 jour. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
solidjs/reactivescript#84 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
solidjs/reactivescript#77 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
solidjs/reactivescript#74 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 3/5 1-2 jours Accessibilité débutants 62/100
solidjs/reactivescript#97 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de solidjs/reactivescript
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
TriliumNext/Trilium#12837 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
LibreChat-AI/LibreChat#18944 ·
Les mainteneurs répondent en général sous 1 jour
-
bug root-cause:found
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
openchamber/openchamber#7620 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
enhancement good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
Anatomik5/codetovideo#8 ·
-
[Bug] Windows Ghidra provider rejects a PATH-only JDK: bare `java.exe` probe fails with Win32 87Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour