Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug]: 'type' missing in import statement of form.tsx #6524

Closed
2 tasks done
Whats-A-MattR opened this issue Jan 31, 2025 · 1 comment
Closed
2 tasks done

[bug]: 'type' missing in import statement of form.tsx #6524

Whats-A-MattR opened this issue Jan 31, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Whats-A-MattR
Copy link

Describe the bug

Current implementation:

import {
  Controller,
  ControllerProps,
  FieldPath,
  FieldValues,
  FormProvider,
  useFormContext,
} from "react-hook-form"

New Implementation:

import {
  Controller,
  type ControllerProps,
  type FieldPath,
  type FieldValues,
  FormProvider,
  useFormContext,
} from "react-hook-form"

Why?
Any time I spin up a new project in Astro I have to update form.tsx because of how Vite handles module loading.
Without these being explicitly declared as Type imports, they're included in the browser bundle.
As far as I understand, doing this shouldn't create issues with other frameworks as it's typical behaviour.

Affected component/components

Form

How to reproduce

Use Form in an Astro (other other Vite based) project, following instructions outlined here:

Codesandbox/StackBlitz link

n/a

Logs

client:1522 [vite] SyntaxError: The requested module '/node_modules/.vite/deps/react-hook-form.js?v=7532505c' does not provide an export named 'ControllerProps' (at form.tsx:6:3)

System Info

MacOS, Chrome.

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@shadcn
Copy link
Collaborator

shadcn commented Mar 5, 2025

Fixed in #4183

@shadcn shadcn closed this as completed Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants