During dev mode, each time node_modules package imports file internally, makes that module have unique identity.

Open
#77 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript, vite

Research direction

Start with the linked reproduction and compare the module imports shown in a.js, b.jsx, and index.jsx during dev mode. Trace why the package's internal imports produce distinct module identities, then verify that compare(uniqueVariable) no longer returns false in the reproduction.

Written by the indexing model from the issue text.

Description

During dev mode, each time node_modules package imports file internally, makes that module have unique identity.

// inside node_modules/some-package

// a.js
export const uniqueVariable = {}

// b.jsx
import { uniqueVariable }  from './a'
export compare = (variable) => uniqueVariable === variable

// index.jsx
import { uniqueVariable }  from './a'
import { compare }  from './b'
compare(uniqueVariable) // Produces false

After updating to latest Solid version, from Solid 1.4.4 I noticed that useContext broke with my library, and that lead me to discovering this issue. The issue only occurs during dev mode and only inside with node_modules.

Reproduction

I manually edited node_module of my package to check.
Screenshot 2022-12-10 at 19 48 28

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.