build: an extensionless "./app" import outside the views bundles app.tsx while TypeScript checks app.ts
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 26/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- bun, typescript
- Domain
- build-system, compilers
Research direction
Start by reading resolveSolidAotModel in microts/compiler/aot-solid-browser.ts (lines 120–127) and resolveImport in tools/build.ts (251–266), and compare which extension each pass prefers for a non-component importer. Reproduce with the app.ts/app.tsx pair from the report, run bun tools/pocket.ts compile --config pocket.host.config.ts --output out/app.pkb, then inspect dist/repro.js for the folded undefined. Done when an extensionless ./app resolves to app.ts in both passes, or the ambiguous specifier is reported as an error.
Written by the indexing model from the issue text.
Description
Version
PocketJS v0.17.0 (83c6cac9, current main). macOS 27.2 arm64, Bun 1.4.2.
Repro
An aot: true, model: "compiled" application whose entry also reads the root model, for example to connect host callbacks.
pocket.host.json, pocket.host.config.ts
{
"format": "pocket-host/2",
"id": "repro-esp32s3",
"platform": "esp-idf",
"form": "takeover",
"cadences": [30],
"display": {
"logicalViewports": [[240, 240]],
"presentations": ["native"],
"rasterDensity": 1,
"animation": "repaint"
},
"panel": { "primary": [240, 240] },
"capabilities": ["input.buttons", "text.glyphs.baked"]
}
// pocket.host.config.ts
import { defineHostConfig } from "@pocketjs/framework/host-config";
export default defineHostConfig({
host: "./pocket.host.json",
app: {
id: "dev.example.repro",
title: "Repro",
version: "0.1.0",
entry: "main.tsx",
output: "repro",
framework: "solid",
viewport: { logical: [240, 240], presentation: "native" },
features: ["input.buttons", "text.glyphs.baked"],
aot: true,
model: "compiled",
},
});
// app.ts
import { createSignal } from "solid-js";
import type { i32 } from "@pocketjs/framework/solid/std";
export const [count, setCount] = createSignal<i32>(0);
export function hostReset(): void {
setCount(0);
}
// app.tsx
import { Text, View } from "@pocketjs/framework/solid/components";
import { count, setCount } from "./app";
export default function App() {
return (
<View class="w-full h-full p-4 bg-slate-100" focusable onPress={() => setCount(count() + 1)}>
<Text class="text-lg text-slate-900">Count {count()}</Text>
</View>
);
}
// main.tsx
import { mount } from "@pocketjs/framework/solid";
import App from "./app.tsx";
import * as model from "./app";
mount(() => {
console.log(`hostReset: ${typeof model.hostReset}`);
return <App />;
});
bun $POCKETJS/tools/pocket.ts compile --config pocket.host.config.ts --output out/app.pkb
Actual
The type check and the build pass:
✓ TypeScript (62 app module(s))
✓ Bundle: out/app.pkb
dist/repro.js resolved ./app to app.tsx, which has no hostReset, and folded the member to undefined:
// main.tsx
mount(() => {
console.log(`hostReset: ${typeof undefined}`);
return createComponent2(App, {});
});
With a named import in main.tsx (import { hostReset } from "./app";) the type check passes and the bundler stops:
error: No matching export in "app.tsx" for import "hostReset"
Expected
The bundle uses the module the type check used. The MicroTS docs name the extensionless path as the model ("Counter.tsx imports its model from ./Counter", microts-solid.md, "Files and ownership"), so ./app resolves to app.ts for every importer in the application, or the build reports the ambiguous specifier.
Cause
resolveSolidAotModel (microts/compiler/aot-solid-browser.ts:120–127) prefers the model only when the importer is a .tsx component of the AOT graph. main.tsx is the entry, not a component, so the request falls through to Bun's resolver, which tries .tsx before .ts. TypeScript tries .ts first. Pass 1 has the same split (resolveImport, tools/build.ts:251–266). A .ts module outside the view graph resolves the same way: a bridge.ts with import * as model from "./app", imported by main.tsx, also bundles typeof model.hostReset as typeof undefined.
Workaround
Write the extension: import * as model from "./app.ts";. The bundle then uses the compiled model module.
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 88
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pocket-stack/pocketjs
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
pocket-stack/pocketjs#729 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pocket-stack/pocketjs#725 ·
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
pocket-stack/pocketjs#724 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 62/100
pocket-stack/pocketjs#728 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
pocket-stack/pocketjs#727 ·
All issues in pocket-stack/pocketjs
Similar issues
-
dream report: normalizeMutation discards ok/status, consumers can only string-match the summaryOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
thecodacus/understory#61 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Termix-SSH/Plugin-Hosts-Config#14 · 1 comment ·
Maintainers usually reply within 4 days
-
ai-generated priority: p2 size: s type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
JonathanTSilva/jts-website#92 ·
Maintainers usually reply within 1 day
-
Toast announcer reads a doubled period when a toast's title ends in punctuationPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel-labs/ui#999 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ehmpathy/rhachet-roles-ehmpathy#1443 ·
Maintainers usually reply within 1 day