I updated `vite-plugin-solid` and now namespaces merged with components are no longer allowed

Open
#145 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript, vite
Domain
build-system

Research direction

Start with the provided .tsx example containing a component and merged namespace, then run vite dev to reproduce the transform error. Compare the behavior with vite-plugin-solid@2.8.0; done means the TypeScript syntax loads without the duplicate-symbol error in the current plugin version.

Written by the indexing model from the issue text.

Description

Describe the bug

If I create a .tsx file with this content

function A() {
    return <>1</>
}

namespace A {
    export const a = 1;
}

console.log(A);

It throws this error when I load the page (Running vite dev)

Transform failed with 1 error:
ERROR: The symbol "A" has already been declared

I tried downgrading vite-plugin-solid and it worked

npm i vite-plugin-solid@2.8.0

(On the playground it always works)

Your Example Website or App

(localhost)

Steps to Reproduce the Bug or Issue
  1. Put a merged namespace declaration WITH A COMPONENT somewhere
  2. Run vite dev
  3. Go to the web page
Expected behavior

I expected this allowed TS syntax to not stop working

Screenshots or Videos

No response

Platform
  • OS: Windows
  • Browser: Edge
  • Version: 120.0.2210.77
Additional context

No response

Dominant language
TypeScript
Stars
520
Forks
70
Avg merge
23h 35m
Merged PRs (30d)
39

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.

More from solidjs/solid-vite-plugin

All issues in solidjs/solid-vite-plugin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.