solidjs / solidjs/solid-playground

Scripts without import/export appear to be duplicated

Open
#104 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
244
Forks
69
PR merge metrics
No merged PRs in 30d

Description

Playground link

image

As described by @modderme123 in https://github.com/solidjs/solid-playground/pull/103#issuecomment-1121503818:

This is an issue with files that don't have imports or exports and are then treated as a global script file. One trick might be to add a tsconfig flag to ignore output_dont_import.tsx?

I tried adding an exclude option to languages.typescript.typescriptDefaults.setCompilerOptions (in src/components/editor/setupSolid.ts) but it doesn't seem to fix the problem.

I previously wrote:

It seems that src/components/editor/monacoTabs.tsx's MonacoTabs creates two models: the model at the top of the function and the model for each tab in tabs. I'm seeing the same source code in both the root model and a tab, which is presumably the source of the problem. [...] Could we remove one of the duplicates (presumably the top-level model?)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the duplication from the linked Playground example, then inspect src/components/editor/monacoTabs.tsx and src/components/editor/setupSolid.ts. Start by tracing how the root model and per-tab models are created and how TypeScript treats files without imports or exports. Done means those scripts no longer appear duplicated without breaking tab compilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.