solidjs / solidjs/solid-vite-plugin

jsx: 'preserve' in optimizeDeps breaks dependency scan when .tsx files use `import.meta.glob`

Open
#262 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe

The vite:dep-scan:transform:js-glob plugin asserts that the return result is js. But the vite-plugin-solid plugin sets jsx: 'preserve'.

Reproduction

https://github.com/zhylmzr/vite-plugin-solid-bug

Workarounds

  1. move import.meta.glob to a single js/ts file.
  2. or change transform.jsx to:
// vite.config.ts
plugins: [
  {
    name: 'fix-solid-deps-scan',
    enforce: 'post',
    config() {
      return {
        optimizeDeps: {
          rolldownOptions: {
            transform: {
              jsx: {
                importSource: 'solid-js/h',
              },
            },
          },
        },
      }
    },
  },
]

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

Start with the vite:dep-scan:transform:js-glob plugin in packages/vite/src/node/optimizer/scan.ts around the referenced line, then reproduce the failure with the linked vite-plugin-solid-bug project. Trace how jsx: 'preserve' affects .tsx files using import.meta.glob. Done means dependency scanning succeeds for this case without requiring either listed workaround.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.