Skip to content

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

Description

@zhylmzr

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',
              },
            },
          },
        },
      }
    },
  },
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions